Opened 15 years ago

Closed 12 years ago

#740 closed defect (fixed)

v.edit returns incorrect results on Windows

Reported by: nuessli Owned by: grass-dev@…
Priority: major Milestone: 6.4.3
Component: LibVector Version: unspecified
Keywords: wingrass Cc: martinl
CPU: x86-32 Platform: MSWindows XP

Description

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.

Attachments (1)

test.grassascii (2.6 KB ) - added by nuessli 15 years ago.
Testing data to reproduce the bug

Download all attachments as: .zip

Change History (10)

by nuessli, 15 years ago

Attachment: test.grassascii added

Testing data to reproduce the bug

comment:1 by martinl, 15 years ago

Keywords: v.edit added

comment:2 by hamish, 15 years ago

Keywords: wingrass added

comment:3 by martinl, 13 years ago

Cc: martinl added
Component: VectorLibVector
Keywords: v.edit removed
Milestone: 6.4.06.4.2

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

in reply to:  3 ; comment:4 by martinl, 13 years ago

Replying to 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

in reply to:  4 comment:5 by martinl, 13 years ago

Replying to martinl:

Replying to 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).

in reply to:  description comment:6 by neteler, 12 years ago

Milestone: 6.4.26.4.3

Replying to 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

in reply to:  description ; comment:7 by mmetz, 12 years ago

Replying to 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

in reply to:  7 comment:8 by mmetz, 12 years ago

Replying to mmetz:

Replying to 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.

comment:9 by hamish, 12 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.