[GRASS-dev] [GRASS GIS] #41: g.mapsets crash

#41: g.mapsets crash
---------------------+------------------------------------------------------
Reporter: neteler | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.3.0
Component: default | Version: svn-trunk
Keywords: |
---------------------+------------------------------------------------------
When launching g.mapsets in a new mapset which was generated on command
line
(this is needed to do parallel computations on a cluster):

{{{
grass63 ~/grassdata/pat/aqua_lst1km20020706.LST_Night_1km.filt
}}}

it crashes:

{{{
GRASS 6.3.svn (pat):~ > g.mapsets add=modisLSTaqua,modisLSTterra
Segmentation fault

GRASS 6.3.svn (pat):~ > gdb `which g.mapsets`
GNU gdb 6.6-1mdv2007.1 (Mandriva Linux release 2007.1)
Copyright (C) 2006 Free Software Foundation, Inc.
...
This GDB was configured as "x86_64-mandriva-linux-gnu"...
Using host libthread_db library "/lib64/libthread_db.so.1".
(gdb) r add=modisLSTaqua,modisLSTterra
Starting program: /home/neteler/grass63/dist.x86_64-unknown-linux-
gnu/bin/g.mapsets add=modisLSTaqua,modisLSTterra

Program received signal SIGSEGV, Segmentation fault.
0x00002ba0dad1904c in G__mapset_name (n=0) at mapset_nme.c:46
46 return mapset_name[n];
(gdb) bt full
#0 0x00002ba0dad1904c in G__mapset_name (n=0) at mapset_nme.c:46
No locals.
#1 0x0000000000401353 in main (argc=2, argv=0x7fffcffdd058) at
main_cmd.c:119
         oldname = 0x0
         n = 0
         i = 0
         skip = 0
         cur_mapset = 0x0
         ptr = (char **) 0x0
         tokens = (char **) 0x0
         no_tokens = 11168
         fp = (FILE *) 0x401a50
         module = (struct GModule *) 0x2ba0daf51680
         opt1 = (struct Option *) 0x2ba0daf515e0
         opt2 = (struct Option *) 0x6074a0
         print = (struct Flag *) 0x607560
         list = (struct Flag *) 0x2ba0daf515a0
(gdb)
}}}

The mapset contains at this stage:

{{{
ls -l ~/grassdata/pat/aqua_lst1km20020706.LST_Night_1km.filt/
total 4
drwxr-xr-x 2 neteler neteler 1024 Feb 9 09:08 dbf/
drwx------ 2 neteler neteler 1024 Feb 9 09:09 tmp/
-rw-r--r-- 1 neteler neteler 66 Feb 9 09:08 VAR
-rw----r-- 1 neteler neteler 293 Feb 9 09:08 WIND
}}}

Also crashes

{{{
g.mapsets -p
Segmentation fault
}}}

for possibly the same (to me unknown) reason.

My tries to debug that with 'ddd' failed.

Markus

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/41&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#41: g.mapsets crash
----------------------+-----------------------------------------------------
  Reporter: neteler | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.3.0
Component: default | Version: svn-trunk
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Comment (by neteler):

Update: apparently the mapset name LENGTH matters:

{{{
grass63 ~/grassdata/pat/abcdefghijklmnopqrstuvwxyz123456
GRASS 6.3.svn (pat):~ > g.mapsets -p
abcdefghijklmnopqrstuvwxyz123456 PERMANENT
exit

grass63 ~/grassdata/pat/abcdefghijklmnopqrstuvwxyz1234567
GRASS 6.3.svn (pat):~ > g.mapsets -p
Segmentation fault

echo -n abcdefghijklmnopqrstuvwxyz1234567 | wc -c
33

}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/41#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#41: g.mapsets crash
----------------------+-----------------------------------------------------
  Reporter: neteler | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.3.0
Component: default | Version: svn-trunk
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Comment (by neteler):

The new g.mapsets changesets [30031] (longer buffers) and [30030] (use
GMAPSET_MAX, GPATH_MAX) did not help.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/41#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

On Sat, 9 Feb 2008, GRASS GIS wrote:

#41: g.mapsets crash
----------------------+-----------------------------------------------------
Reporter: neteler | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.3.0
Component: default | Version: svn-trunk
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Comment (by neteler):

The new g.mapsets changesets [30031] (longer buffers) and [30030] (use
GMAPSET_MAX, GPATH_MAX) did not help.

Hi Markus,
Line 33 in lib/gis/mapset.c:
static char mapset[30];
looks like it may be the problem here. I don't have SVN access right now or else I'd change it myself..

Paul

#41: g.mapsets crash
----------------------+-----------------------------------------------------
  Reporter: neteler | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.3.0
Component: default | Version: svn-trunk
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Comment (by neteler):

As suggested by Paul, fixed as [30032]
(http://trac.osgeo.org/grass/changeset/30032).

I am not sure yet about the exit status of the function.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/41#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#41: g.mapsets crash
----------------------+-----------------------------------------------------
  Reporter: neteler | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-trunk
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Changes (by neteler):

  * milestone: 6.3.0 => 6.4.0

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/41#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#41: g.mapsets crash
----------------------+-----------------------------------------------------
  Reporter: neteler | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-trunk
Resolution: fixed | Keywords:
----------------------+-----------------------------------------------------
Changes (by neteler):

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

Comment:

Now it works. Closed.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/41#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>
Commonly referred to as GRASS, this is a Geographic Information System (GIS) used for geospatial data management and analysis, image processing, graphics/maps production, spatial modeling, and visualization. GRASS is currently used in academic and commercial settings around the world, as well as by many governmental agencies and environmental consulting companies. GRASS is official project of the Open Source Geospatial Foundation.