Skip to content

[Bug] d.vect where clause fails for queries with spaces on Windows #1063

@pmozbert

Description

@pmozbert

Describe the bug
The where clause in d.vect fails on Windows for queries that contain spaces. Similar queries in where clause in v.extract works fine on Windows. The same commands were also tested and are working fine on Linux

To Reproduce
I am using GRASS 7.8.4, testing on Windows 10 and on Ubuntu 20.04.1
I installed from MSI on Windows, and with apt-get on Ubuntu, from ubuntugis-unstable.

This works on both windows and Linux
d.vect map=NHDWater where="FCODE=43613"

All of the following fail on Windows, but work on Linux.

d.vect map=NHDWater where="FCODE = 43613"
ERROR: Sorry <=> is not a valid option
d.vect map=NHDWater where="FCODE=39004 and AREASQKM > 2"
The system cannot find the path specified.
d.vect map=NHDWater where="AREASQKM > 2 AND FCODE=39004"
ERROR: Sorry <FCODE=39004> is not a valid option
d.vect map=NHDWater where="FCODE IN (43600,43613)"
WARNING: Illegal filename <(43600,43613)">. Character <,> not allowed.
ERROR: Vector map <(43600,43613)"> not found
Syntax error: No closing quotationTraceback (most recent call last):
  File "C:\Program Files\GRASS GIS 7.8\Python37\lib\site-packages\wx\core.py", line 2254, in Notify
    self.notify()
  File "C:\Program Files\GRASS GIS 7.8/gui/wxpython/mapdisp/main.py", line 593, in watcher
    self.mapFrm.GetMap().GetLayersFromCmdFile()
  File "C:\Program Files\GRASS GIS 7.8/gui/wxpython/mapdisp/main.py", line 187, in GetLayersFromCmdFile
    ltype = utils.command2ltype[cmd[0]]
IndexError: list index out of range

d.vect map=NHDWater where="AREASQKM > 2"
The system cannot find the path specified.

It also cannot deal with less than an greater than operators. This works on Linux but fails on Windows

d.vect map=NHDWater where="AREASQKM>2"
The system cannot find the path specified.
d.vect map=NHDWater where="AREASQKM > .5 AND FCODE=43600"
ERROR: Sorry <FCODE=43600> is not a valid option
d.vect map=NHDWater where="AREASQKM > .5 AND FCODE IN (43600,43613)"
WARNING: Illegal filename <(43600,43613)">. Character <,> not allowed.
ERROR: Vector map <(43600,43613)"> not found

Expected behavior
The where clause should not fail on Windows when it has spaces in it, and should behave the same as on Linux

BTW, The where clause in v.extract works fine on Windows

v.extract input=NHDWater where="AREASQKM > .5 AND FCODE IN (43600,43613)" output=NHDWaterExtract
Extracting features...
 100%
Building topology for vector map <NHDWaterExtract@Essex>...
Registering primitives...
Building areas...
 100%
Attaching islands...
 100%
Attaching centroids...
 100%
Writing attributes...

Screenshots
If applicable, add screenshots to help explain your problem.

System description (please complete the following information):

  • Operating System: [e.g. Windows, Linux, ..., incl. version]
    Windows 10 - has bug
    Ubuntu 20.04.1 - works fine

  • GRASS GIS version [e.g. 7.8.1]
    7.8.4

version=7.8.4
date=2020
revision=d8fbd49af
build_date=2020-10-05
build_platform=x86_64-w64-mingw32
build_off_t_size=8
libgis_revision=d8fbd49af
libgis_date=2020-10-05T06:39:31+00:00
proj=6.3.2
gdal=3.0.4
geos=3.8.1
sqlite=3.29.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions