[GRASS-dev] [GRASS GIS] #1844: wingrass: db_open_select_cursor fails for DBF driver.

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.3
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------
There is problem with DBF driver on MS Windows. To reproduce this bug run:

{{{
db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
v.random out=n n=3
v.db.addtable map=n columns="class varchar(10)"
}}}

It stops at source:grass/trunk/lib/db/dbmi_client/c_openselect.c#L63

{{{
D3/5: db_select_int()
D3/5: SQL: SELECT cat FROM n
D3/5: SQL statement parsed successfully: SELECT cat FROM n
D2/5: find_table(): table = n
D2/5: ? n
D2/5: load_table_head(): tab = 0,
/opt/grassdata/nc_spm_08_grass7/dbf/dbf//n.dbf
D2/5: ncols = 2
D2/5: DBFFieldType 1
D3/5: add_column(): tab = 0, type = 2, name = cat, width = 11, decimals =
0
D2/5: DBFFieldType 0
D3/5: add_column(): tab = 0, type = 1, name = class, width = 10, decimals
= 0
D3/5: Doing SQL command <4> on DBF table... (see include/sqlp.h)
D2/5: SELECT
D2/5: sel(): tab = 0
D2/5: load_table(): tab = 0
D2/5: ncols = 2 nrows = 0
D2/5: load_table_head(): tab = 0,
/opt/grassdata/nc_spm_08_grass7/dbf/dbf//n.dbf
}}}

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------
Changes (by martinl):

  * milestone: 6.4.3 => 7.0.0

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by mmetz):

On Windows,
{{{
$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
}}}
should not translate to
{{{
/opt/grassdata/nc_spm_08_grass7/dbf/dbf/
}}}
because this is not a valid path on Windows.

Can you post the output of `g.gisenv`?

Markus M

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by hellik):

Replying to [comment:2 mmetz]:
> On Windows,
> {{{
> $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
> }}}
> should not translate to
> {{{
> /opt/grassdata/nc_spm_08_grass7/dbf/dbf/
> }}}
> because this is not a valid path on Windows.
>
> Can you post the output of `g.gisenv`?
>

maybe related http://trac.osgeo.org/grass/ticket/1796 ?

http://trac.osgeo.org/grass/ticket/1796#comment:14

still valid

Helmut

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by mmetz):

Replying to [comment:3 hellik]:
>
> still valid
>

still valid ?

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by hellik):

Replying to [comment:4 mmetz]:
> Replying to [comment:3 hellik]:
> >
> > still valid
> >
>
> still valid ?

tested here with

{{{
GRASS version: 7.0.svn
GRASS SVN Revision: 55413
Build Date: 2013-02-18
GIS Library Revision: 52468 (2012-07-27)
GDAL/OGR: 1.9.2
PROJ.4: 4.8.0
GEOS: 3.3.6dev
SQLite: 3.7.10
Python: 2.7.2
wxPython: 2.8.12.1
Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
}}}

it works here.

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by neteler):

Still an issue?

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by neteler):

Replying to [ticket:1844 martinl]:
> There is problem with DBF driver on MS Windows. To reproduce this bug
run:
>
> {{{
> db.connect driver=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'

For me (Windows8, version of today, it already hangs here.

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
Reporter: martinl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Keywords: wingrass, dbf | Platform: MSWindows 2K
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by hamish):

One oddity, 'db.connect -p' in trunk expands the $GISDBASE/$L/$M to the
full pathname, while the VAR file stores it as the variable. As it is
possible to hard-code in the VAR file, by auto-expanding there's no way to
tell the difference, and if your current mapset will be portable if you
rename or copy the mapset, change the drive it's on, etc.

--

Testing grass7 nightly snapshot from a few days ago on XP, db.connect
works ok, but v.db.addtable, v.db.addcolumn, and other v.db.* from the
C:\> grass prompt do nothing, just silently return, even with --help or
--ui.

  echo %errorlevel%

comes back as 9009, which translates to "Program is not recognized as an
internal or external command, operable program or batch file".
  http://www.febooti.com/products/automation-workshop/online-help/events
/run-dos-cmd-command/exit-codes/

other times just an errorlevel of 0. strange. From the wxGUI menu
v.db.addtable worked.

maybe a sometimes bug -> race condition?

From the Msys prompt you can get the program to wake up, but only if you
add the .py extension. It seemed to lock up on me for the first try, but
then ok? (with dbf/ dir re-removed) when I go to exit I get a traceback
from grass.py with _subprocess.INFINITE, "Terminate batch job (Y/N)?"

Hamish

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

#1844: wingrass: db_open_select_cursor fails for DBF driver.
---------------------------+------------------------------------------------
  Reporter: martinl | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: critical | Milestone: 7.0.0
Component: Database | Version: unspecified
Resolution: fixed | Keywords: wingrass, dbf
  Platform: MSWindows 2K | Cpu: Unspecified
---------------------------+------------------------------------------------
Changes (by martinl):

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

Comment:

I checked again, and it seems to work with the most recent version from
SVN. Closing, please re-open if neeed.

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