[GRASS-dev] [GRASS GIS] #1020: Display of vector maps fails

#1020: Display of vector maps fails
----------------------+-----------------------------------------------------
Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Keywords: wingrass | Platform: MSWindows 7
      Cpu: x86-64 |
----------------------+-----------------------------------------------------
GRASS freezes when trying to open a vector map. Both Apply and OK buttons
has been tested.
Raster maps can be opened with no problem.

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Changes (by martinl):

  * priority: normal => blocker

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by marisn):

Works fine on Vista WinGRASS-6.4.SVN-r41749-1.

Could be something like Vista UAC related issues?

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by marisn):

I also noticed, that enabling DEBUG will make WxGUI to hang (Not
responding). MilenaN - can You run "g.gisenv set='DEBUG=0'" in GUI CMD
prompt or CMD and then try to display vector map?

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [ticket:1020 MilenaN]:
> GRASS freezes when trying to open a vector map. Both Apply and OK
buttons has been tested.
> Raster maps can be opened with no problem.

I have similar problem on MS Windows 2008.

Running GRASS locally from MSYS works, i.e. I can display a vector map.

{{{
landa@GEO1 /osgeo4w/usr/src/grass64_release
$ ./bin.i686-pc-mingw32/grass64 -wx
}}}

Running installed version, GRASS freezes when displaying a vector map.
Reason is {{{db.describe}}} command which is launched on the background.

{{{
GUI D1/1: gcmd.Command(): db.describe -c --q table=archsites driver=dbf
database=C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/
UPOZORNÌNÍ: Nelze spustit pøíkaz
}}}

When running manually from MSYS

{{{
GRASS 6.4> db.describe -c --q table=archsites driver=dbf
database="C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/"
Bad file descriptor: Files
}}}

The same command works when running the command from OSGeo MSYS

{{{
db.describe -c --q table=archsites driver=dbf
database="C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/"
ncols: 2
nrows: 25
Column 1: cat:INTEGER:11
Column 2: str1:CHARACTER:30
}}}

Any pointers?

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by hamish):

> When running manually from MSYS
{{{
GRASS 6.4> db.describe -c --q table=archsites driver=dbf \
   database="C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/"
Bad file descriptor: Files
}}}

... perhaps stating the obvious, but it looks like we missed quoting a
path name variable and the $GISBASE/driver/db/dbf program is being sent as
"C:\Program" and then "Files\GRASS64\..." ??

what do the previous debug messages say with DEBUG=5?

Hamish

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:5 hamish]:
> > When running manually from MSYS
{{{
> GRASS 6.4> db.describe -c --q table=archsites driver=dbf \
> database="C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/"
> Bad file descriptor: Files
}}}
>
> ... perhaps stating the obvious, but it looks like we missed quoting a
path name variable and the $GISBASE/driver/db/dbf program is being sent as
"C:\Program" and then "Files\GRASS64\..." ??
>
> what do the previous debug messages say with DEBUG=5?

Doesn't seems to be that problem (note that $GISBASE contains a space)

{{{
GRASS 6.4> db.describe -c --q table=archsites driver=dbf
database="C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/"
D2/5: dbDbmscap(): opendir [c:\osgeo4w\usr\src\grass64 release\dist.i686-
pc-mingw32\driver\db\]
D2/5: dbDbmscap(): opendir [c:\osgeo4w\usr\src\grass64 release\dist.i686-
pc-mingw32\driver\db\]
D2/5: dbmi_client/start startup: [c:\osgeo4w\usr\src\grass64 release\dist.
i686-pc-mingw32\driver\db\dbf.exe]
D2/5: DBF: db__driver_open_database() name = 'C:\Users\landa\grass
data/spearfish60/PERMANENT/dbf/'
D2/5: db.name = C:\Users\landa\grass data/spearfish60/PERMANENT/dbf/
...
}}}

But

{{{
GRASS 6.4> db.describe -c --q table=archsites driver=dbf
database="C:\Users\land
D2/5: dbDbmscap(): opendir [c:\Program Files (x86)\GRASS-64-
SVN\driver\db\]
D2/5: dbDbmscap(): opendir [c:\Program Files (x86)\GRASS-64-
SVN\driver\db\]
D2/5: dbmi_client/start startup: [c:\Program Files (x86)\GRASS-64-
SVN\driver\db\
Bad file descriptor: Files
}}}

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:6 martinl]:
> But
>
{{{
> GRASS 6.4> db.describe -c --q table=archsites driver=dbf
database="C:\Users\land
> D2/5: dbDbmscap(): opendir [c:\Program Files (x86)\GRASS-64-
SVN\driver\db\]
> D2/5: dbDbmscap(): opendir [c:\Program Files (x86)\GRASS-64-
SVN\driver\db\]
> D2/5: dbmi_client/start startup: [c:\Program Files (x86)\GRASS-64-
SVN\driver\db\
> Bad file descriptor: Files
}}}

seems to be problem with _spawnl
[source:grass/branches/releasebranch_6_4/lib/db/dbmi_client/start.c@41132#L221]

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by hamish):

is "C:\Program Files (x86)" common for 64bit Windows7 or a local install
choice? Including $arch there is something new to me. Is that $arch seen
with Vista 64bit too?

> seems to be problem with _spawnl
> grass/branches/releasebranch_6_4/lib/db/dbmi_client/start.c@41132#L221

apparently so.

that is the only place in the 6.4 code that uses _spawnl(), although
lib/gis/system.c uses, and comments in g.parser speak of _spawnlp().

one obvious thing is that in the non-osgeo4w install the `startup` string
does is missing an executable name (which must end in .exe for _spawnl()
too), it is just the dir. (but where is the closing "]" on that string
too?)

Hamish

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by glynn):

Replying to [comment:7 martinl]:

> seems to be problem with _spawnl

Yep. _spawnl() simply concatenates its arguments, with spaces between
them; it doesn't perform any quoting.

An example of "correct" quoting can be found in escape_arg() in
lib/gis/spawn.c. "correct" in quotes because it's up to the C runtime as
to how to parse the command line into individual arguments; the
escape_arg() function matches the MSVC behaviour, and is the same
algorithm as used by e.g. Python's subprocess module (see list2cmdline()
in subprocess.py).

MSDN reference: http://msdn.microsoft.com/en-us/library/17w5ykft.aspx

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:9 glynn]:
> > seems to be problem with _spawnl
>
> Yep. _spawnl() simply concatenates its arguments, with spaces between
them; it doesn't perform any quoting.
>
> An example of "correct" quoting can be found in escape_arg() in
lib/gis/spawn.c. "correct" in quotes because it's up to the C runtime as
to how to parse the command line into individual arguments; the
escape_arg() function matches the MSVC behaviour, and is the same
algorithm as used by e.g. Python's subprocess module (see list2cmdline()
in subprocess.py).
>
> MSDN reference: http://msdn.microsoft.com/en-us/library/17w5ykft.aspx

Couldn't we use simply G_spawn() or G_spawn_ex()?

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass, db.describe, wxGUI
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Changes (by martinl):

  * keywords: wingrass => wingrass, db.describe, wxGUI
  * component: wxGUI => Database

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass, db.describe, wxGUI
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by glynn):

Replying to [comment:11 martinl]:

> Couldn't we use simply G_spawn() or G_spawn_ex()?

Assuming that the current G_spawn_ex() works reliably on Windows, it can
be used. Earlier versions didn't support redirection of stdin/stdout on
Windows.

The new version made it into RC6, so I'm assuming that it's basically
okay.

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

#1020: Display of vector maps fails
--------------------------+-------------------------------------------------
  Reporter: MilenaN | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Resolution: | Keywords: wingrass, db.describe, wxGUI
  Platform: MSWindows 7 | Cpu: x86-64
--------------------------+-------------------------------------------------
Comment (by hamish):

Glynn:
> The new version made it into RC6, so I'm assuming that it's
> basically okay.

..although nothing there actually calls it, the 6.4 lib/gis/spawn.c is
identical to the version which is used by g.gui in 6.5, so presumably it's
pretty well tested by now.

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

#1020: Display of vector maps fails
------------------------------------------+---------------------------------
Reporter: MilenaN | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Keywords: wingrass, db.describe, wxGUI | Platform: MSWindows 7
      Cpu: x86-64 |
------------------------------------------+---------------------------------

Comment(by martinl):

Replying to [comment:13 glynn]:
> Replying to [comment:11 martinl]:
>
> > Couldn't we use simply G_spawn() or G_spawn_ex()?
>
> Assuming that the current G_spawn_ex() works reliably on Windows, it can
be used. Earlier versions didn't support redirection of stdin/stdout on
Windows.
>
> The new version made it into RC6, so I'm assuming that it's basically
okay.

my wild guess

{{{
      G_debug(2, "dbmi_client/start startup: [%s]", startup);
- pid = _spawnl(_P_NOWAIT, startup, startup, NULL);
+ pid = G_spawn_ex(startup, startup, NULL);
}}}

fails. Any hits how to fix this blocker issue.

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

#1020: Display of vector maps fails
------------------------------------------+---------------------------------
Reporter: MilenaN | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Keywords: wingrass, db.describe, wxGUI | Platform: MSWindows 7
      Cpu: x86-64 |
------------------------------------------+---------------------------------

Comment(by glynn):

Most of the bottom half of db_start_driver() (the part that's split into
distinct !Windows/Unix versions) should be replaced with a call to
G_spawn_ex().

Try r42651.

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

#1020: Display of vector maps fails
------------------------------------------+---------------------------------
Reporter: MilenaN | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Keywords: wingrass, db.describe, wxGUI | Platform: MSWindows 7
      Cpu: x86-64 |
------------------------------------------+---------------------------------

Comment(by martinl):

Replying to [comment:16 glynn]:
> Most of the bottom half of db_start_driver() (the part that's split into
distinct !Windows/Unix versions) should be replaced with a call to
G_spawn_ex().
>
> Try r42651.

Thanks! Seems to work, backported in r42654 to devbr6 (available for
testing in the next daily build on http://josef.fsv.cvut.cz/wingrass).
Martin

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

#1020: Display of vector maps fails
------------------------------------------+---------------------------------
Reporter: MilenaN | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Keywords: wingrass, db.describe, wxGUI | Platform: MSWindows 7
      Cpu: x86-64 |
------------------------------------------+---------------------------------

Comment(by martinl):

Replying to [comment:17 martinl]:

> Thanks! Seems to work, backported in r42654 to devbr6 (available for
testing in the next daily build on http://josef.fsv.cvut.cz/wingrass).
Martin

Seems to also work in devbr6. When displaying archsites from spearfish60 I
am just getting some warnings

{{{
G_spawn: unable to redirect descriptor 4
G_spawn: unable to redirect descriptor 5
}}}

Any idea how it could be fixed. Thanks.

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

#1020: Display of vector maps fails
------------------------------------------+---------------------------------
Reporter: MilenaN | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Keywords: wingrass, db.describe, wxGUI | Platform: MSWindows 7
      Cpu: x86-64 |
------------------------------------------+---------------------------------

Comment(by glynn):

Replying to [comment:18 martinl]:

> Seems to also work in devbr6. When displaying archsites from spearfish60
I am just getting some warnings
>
{{{
G_spawn: unable to redirect descriptor 4
G_spawn: unable to redirect descriptor 5
}}}
>
> Any idea how it could be fixed. Thanks.

Backport r40905.

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

#1020: Display of vector maps fails
------------------------------------------+---------------------------------
Reporter: MilenaN | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.0
Component: Database | Version: 6.4.0 RCs
Keywords: wingrass, db.describe, wxGUI | Platform: MSWindows 7
      Cpu: x86-64 |
------------------------------------------+---------------------------------

Comment(by martinl):

Replying to [comment:19 glynn]:
> Replying to [comment:18 martinl]:
>
> > Seems to also work in devbr6. When displaying archsites from
spearfish60 I am just getting some warnings
> Backport r40905.

Done in r42667 (devbr6) and r42668 (relbr64). Martin

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