[GRASS-dev] [GRASS GIS] #740: v.edit returns incorrect results on Windows

#740: v.edit returns incorrect results on Windows
---------------------+------------------------------------------------------
Reporter: nuessli | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: unspecified
Keywords: | Platform: MSWindows XP
      Cpu: x86-32 |
---------------------+------------------------------------------------------
How to produce the bug:
-Import the data attached (v.in.ascii format=standard)

-Ask for the IDs having cats=2 in layer 2 (v.edit layer=2 tool=select
cats=2 type=centroid)
=>Should return 3 ids but only 2 are returned...

-Ask for the IDs having cat=3 in layer 1 (v.edit layer=1 tool=select
cats=3 type=centroid)
=>Should return 3 ids but only 2 are returned...

This has been tested on 3 different computers on Grass 6.3.0, Grass 6.4RC5
and Grass 6.4svn(unknown revision). All give exactly the same wrong
result.

This happens only under Windows: Linux versions always return the correct
result, namely 3 ids in the two cases.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
---------------------------+------------------------------------------------
  Reporter: nuessli | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.edit
  Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Changes (by martinl):

  * keywords: => v.edit

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
---------------------------+------------------------------------------------
  Reporter: nuessli | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.edit, wingrass
  Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Changes (by hamish):

  * keywords: v.edit => v.edit, wingrass

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/740#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
-----------------------+----------------------------------------------------
Reporter: nuessli | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: LibVector | Version: unspecified
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------+----------------------------------------------------
Changes (by martinl):

* cc: martinl (added)
  * keywords: v.edit, wingrass => wingrass
  * component: Vector => LibVector
  * milestone: 6.4.0 => 6.4.2

Comment:

It's seems to be a bug in Vlib category index management, wrong result
returns `Vect_cidx_find_all()`

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
-----------------------+----------------------------------------------------
Reporter: nuessli | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: LibVector | Version: unspecified
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------+----------------------------------------------------

Comment(by martinl):

Replying to [comment:3 martinl]:
> It's seems to be a bug in Vlib category index management, wrong result
returns `Vect_cidx_find_all()`

See `v.build opt=cdump` output

{{{
------------------------------------------------------------------------------------------
Layer 2 number of unique cats: 1 number of cats: 6
number of types: 2
------------------------------------------------------------------------------------------
             type | count
                8 | 3
               64 | 3
  category | type | line/area
         2 | 8 | 26
         2 | 8 | 29
         2 | 64 | 5
         2 | 64 | 7
         2 | 64 | 10
         2 | 8 | 24
------------------------------------------------------------------------------------------
}}}

There is

{{{
         2 | 8 | 24
}}}

missing

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
-----------------------+----------------------------------------------------
Reporter: nuessli | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: LibVector | Version: unspecified
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------+----------------------------------------------------

Comment(by martinl):

Replying to [comment:4 martinl]:
> Replying to [comment:3 martinl]:
> > It's seems to be a bug in Vlib category index management, wrong result
returns `Vect_cidx_find_all()`
>
> See `v.build opt=cdump` output
>
{{{
>
------------------------------------------------------------------------------------------
> Layer 2 number of unique cats: 1 number of cats: 6
number of types: 2
>
------------------------------------------------------------------------------------------
> type | count
> 8 | 3
> 64 | 3
> category | type | line/area
> 2 | 8 | 26
> 2 | 8 | 29
> 2 | 64 | 5
> 2 | 64 | 7
> 2 | 64 | 10
> 2 | 8 | 24
>
------------------------------------------------------------------------------------------
}}}
>
> There is
>
{{{
> 2 | 8 | 24
}}}
>
> missing

ops, it's not missing, it's just reported as the last item (strange).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
-----------------------+----------------------------------------------------
Reporter: nuessli | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: LibVector | Version: unspecified
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------+----------------------------------------------------
Changes (by neteler):

  * milestone: 6.4.2 => 6.4.3

Comment:

Replying to [ticket:740 nuessli]:
> How to produce the bug:
> -Import the data attached (v.in.ascii format=standard)

{{{
v.in.ascii --overwrite input=C:\Users\neteler\Downloads\test.grassascii
output=testascii format=standard
}}}

> -Ask for the IDs having cats=2 in layer 2 (v.edit layer=2 tool=select
cats=2 type=centroid)
> =>Should return 3 ids but only 2 are returned...

{{{
v.edit testascii layer=2 tool=select cats=2 type=centroid
26,29
Selecting features...
2 of 29 features selected from vector map <testascii@user1>
v.edit complete.
}}}

> -Ask for the IDs having cat=3 in layer 1 (v.edit layer=1 tool=select
cats=3 type=centroid)
> =>Should return 3 ids but only 2 are returned...

{{{
v.edit testascii layer=1 tool=select cats=3 type=centroid
29,27
Selecting features...
2 of 29 features selected from vector map <testascii@user1>
v.edit complete.
}}}

> This has been tested on 3 different computers on Grass 6.3.0, Grass
6.4RC5 and Grass 6.4svn(unknown revision). All give exactly the same wrong
result.

{{{
v.build testascii opt=cdump
---------- CATEGORY INDEX DUMP: Number of layers: 3
--------------------------------------
Layer 0 number of unique cats: 1 number of cats: 19
number of types: 1
------------------------------------------------------------------------------------------
             type | count
                4 | 19
  category | type | line/area
         0 | 4 | 1
         0 | 4 | 2
         0 | 4 | 3
         0 | 4 | 4
         0 | 4 | 5
         0 | 4 | 6
         0 | 4 | 7
         0 | 4 | 8
         0 | 4 | 9
         0 | 4 | 10
         0 | 4 | 11
         0 | 4 | 12
         0 | 4 | 13
         0 | 4 | 14
         0 | 4 | 15
         0 | 4 | 16
         0 | 4 | 17
         0 | 4 | 18
         0 | 4 | 19
------------------------------------------------------------------------------------------
Layer 1 number of unique cats: 7 number of cats: 26
number of types: 2
------------------------------------------------------------------------------------------
             type | count
                8 | 13
               64 | 13
  category | type | line/area
         1 | 64 | 5
         1 | 64 | 6
         1 | 8 | 26
         1 | 8 | 25
         1 | 8 | 24
         1 | 64 | 7
         2 | 64 | 4
         2 | 64 | 5
         2 | 8 | 24
         2 | 8 | 23
         3 | 8 | 29
         3 | 8 | 27
         3 | 64 | 8
         3 | 64 | 10
         3 | 8 | 26
         3 | 64 | 7
         4 | 8 | 20
         4 | 64 | 1
         5 | 64 | 9
         5 | 8 | 29
         5 | 8 | 28
         5 | 64 | 10
         6 | 8 | 21
         6 | 64 | 2
         7 | 8 | 22
         7 | 64 | 3
------------------------------------------------------------------------------------------
Layer 2 number of unique cats: 1 number of cats: 6
number of types: 2
------------------------------------------------------------------------------------------
             type | count
                8 | 3
               64 | 3
  category | type | line/area
         2 | 8 | 26
         2 | 8 | 29
         2 | 64 | 5
         2 | 64 | 7
         2 | 64 | 10
         2 | 8 | 24
------------------------------------------------------------------------------------------
}}}

Tested on today's WinGRASS:

{{{
g.version -g
version=6.4.3svn
revision=55719
date=2013
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
-----------------------+----------------------------------------------------
Reporter: nuessli | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: LibVector | Version: unspecified
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------+----------------------------------------------------

Comment(by mmetz):

Replying to [ticket:740 nuessli]:
> This happens only under Windows: Linux versions always return the
correct result, namely 3 ids in the two cases.

qsort on Windows behaves a bit different than on other platforms. Fixed in
trunk r55745.

Markus M

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
-----------------------+----------------------------------------------------
Reporter: nuessli | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.3
Component: LibVector | Version: unspecified
Keywords: wingrass | Platform: MSWindows XP
      Cpu: x86-32 |
-----------------------+----------------------------------------------------

Comment(by mmetz):

Replying to [comment:7 mmetz]:
> Replying to [ticket:740 nuessli]:
> > This happens only under Windows: Linux versions always return the
correct result, namely 3 ids in the two cases.
>
> qsort on Windows behaves a bit different than on other platforms. Fixed
in trunk r55745.

Backported to relbr64/devbr6 in r55749-50.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/740#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#740: v.edit returns incorrect results on Windows
---------------------------+------------------------------------------------
  Reporter: nuessli | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.3
Component: LibVector | Version: unspecified
Resolution: fixed | Keywords: wingrass
  Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Changes (by hamish):

  * status: new => closed
  * resolution: => fixed

Comment:

mmetz:
> Backported to relbr64/devbr6 in r55749-50.

tested report example in 6.5 latest nightly build; it's ok now: 3 ids
returned.
closing bug.

thanks

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/740#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>