[GRASS-dev] [grass-code I][431] g.copy segmentation fault

Volker Wichmann wichmann at laserdata.at
Wed Jul 25 03:22:20 EDT 2007


Glynn Clements wrote:
>
> You will need to provide more detailed information, i.e. the complete
> backtrace at the point of the segfault and the values of any relevant
> variables.
>

I did a backtrace, placed a break point a few lines before the crash and 
did a re-run. Here is the output:

-------------------------------------------------------------------------------------------------
Starting program: /usr/local/grass-6.3.cvs/bin/g.copy rast=last.min,test5
[Thread debugging using libthread_db enabled]
[New Thread -1208260912 (LWP 4913)]
Copy raster <last.min at PERMANENT> to current mapset as <test5>
[Switching to Thread -1208260912 (LWP 4913)]

Breakpoint 1, do_copy (n=0, old=0x897c270 "last.min",
mapset=0x897c2b8 "PERMANENT", new=0x897c280 "test5") at do_copy.c:31
31 hold_signals(1);
(gdb) next
32 if ( G_strcasecmp (list[n].alias, "vect") == 0 ) {
(gdb) next
40 for (i = 0; i < list[n].nelem; i++)
(gdb) next
35 G_warning ("Cannot copy <%s> to current mapset as <%s>",
(gdb) next
42 G__make_mapset_element (list[n].element[i]);
(gdb) next
43 G__file_name (path, list[n].element[i], old, mapset);
(gdb) next
44 if (access (path, 0) != 0)
(gdb) next
52 G__file_name (path2, list[n].element[i], new, G_mapset());
(gdb) next
53 if ( recursive_copy(path, path2) == 1 )
(gdb) print path
$1 = 
"/data/grassdb/demo/PERMANENT/cell/last.min\000\217\221\000\001\000\000\000\b\000\000\000��������\000\000\000\000\200s�\000��\227\b\003\000\000\000\000\000\000\000���\000\000\000\000\000Q���", 
'\0' <repeats 16 times>, 
"�o�\000\000\000\000\000ص\227\b\001\000\000\000\000\000\000\000\002\000\000\000ص\227\b���\000����8���\202B\025\000�{�\000ص\227\b 
\000\000\000�xP�\000\000\000\000ص\227\b\202��\000K֨\000\202��\000 
\201�\000Q\000\000\000L\201�\000\000\000\000\000"...
(gdb) print path2
$2 = "/data/grassdb/demo/PERMANENT/cell/test5\000\227\b\001\000\000\000 
\000\000\000\002\000\000\000�輿3d.view:3dview:3D viewing parameters:3D 
view parameters\000\000n files\000\000���\217\221\000x\221��L鼿\200鼿�h 
\220\000\000\000\000\000kI \024\000㰬\000�\217\221\000�'���q�\000nȫ\000\ 
f\226\227\b\000\000\000\000 
\212\224\227\b�o�\000W\030\031\000\000\000\000\000T�"...
(gdb) next
59 if (G_verbose() == G_verbose_max())
(gdb) next
40 for (i = 0; i < list[n].nelem; i++)
(gdb) next

Program received signal SIGSEGV, Segmentation fault.
do_copy (n=0, old=0x897c270 "last.min", mapset=0x897c2b8 "PERMANENT",
new=0x897c280 "test5") at do_copy.c:40
40 for (i = 0; i < list[n].nelem; i++)
(gdb) print i
$3 = 0
(gdb) print n
$4 = 0
(gdb) print list[n].nelem
$5 = 8
(gdb) print path
$6 = 
"/data/grassdb/demo/PERMANENT/cell/last.min\000\217\221\000\001\000\000\000\b\000\000\000��������\000\000\000\000\200s�\000��\227\b\003\000\000\000\000\000\000\000���\000\000\000\000\000Q���", 
'\0' <repeats 16 times>, 
"�o�\000\000\000\000\000ص\227\b\001\000\000\000\000\000\000\000\002\000\000\000ص\227\b���\000����8���\202B\025\000�{�\000ص\227\b 
\000\000\000�xP�\000\000\000\000ص\227\b\202��\000K֨\000\202��\000 
\201�\000Q\000\000\000L\201�\000\000\000\000\000"...
(gdb) print path2
$7 = "/data/grassdb/demo/PERMANENT/cell/test5\000\227\b\001\000\000\000 
\000\000\000\002\000\000\000�輿3d.view:3dview:3D viewing parameters:3D 
view parameters\000\000n files\000\000���\217\221\000x\221��L鼿\200鼿�h 
\220\000\000\000\000\000kI \024\000㰬\000�\217\221\000�'���q�\000nȫ\000\ 
f\226\227\b\000\000\000\000 
\212\224\227\b�o�\000W\030\031\000\000\000\000\000T�"...
(gdb) bt full
#0 do_copy (n=0, old=0x897c270 "last.min", mapset=0x897c2b8 "PERMANENT",
new=0x897c280 "test5") at do_copy.c:40
i = 0
ret = <value optimized out>
path = 
"/data/grassdb/demo/PERMANENT/cell/last.min\000\217\221\000\001\000\000\000\b\000\000\000��������\000\000\000\000\200s�\000��\227\b\003\000\000\000\000\000\000\000���\000\000\000\000\000Q���", 
'\0' <repeats 16 times>, 
"�o�\000\000\000\000\000ص\227\b\001\000\000\000\000\000\000\000\002\000\000\000ص\227\b���\000����8���\202B\025\000�{�\000ص\227\b 
\000\000\000�xP�\000\000\000\000ص\227\b\202��\000K֨\000\202��\000 
\201�\000Q\000\000\000L\201�\000\000\000\000\000"...
path2 = 
"/data/grassdb/demo/PERMANENT/cell/test5\000\227\b\001\000\000\000 
\000\000\000\002\000\000\000�輿3d.view:3dview:3D viewing parameters:3D 
view parameters\000\000n files\000\000���\217\221\000x\221��L鼿\200鼿�h 
\220\000\000\000\000\000kI \024\000㰬\000�\217\221\000�'���q�\000nȫ\000\ 
f\226\227\b\000\000\000\000 
\212\224\227\b�o�\000W\030\031\000\000\000\000\000T�"...
result = 0
#1 0x080493eb in main (argc=2, argv=0xbfbcf1a4) at copy.c:95
n = <value optimized out>
mapset = 0x897c2b8 "PERMANENT"
module = (struct GModule *) 0x199b90
parm = (struct Option **) 0x897b5d8
p = <value optimized out>
---Type <return> to continue, or q <return> to quit---
to = 0x897c280 "test5"
result = 0
(gdb) continue
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
-------------------------------------------------------------------------------------------------


Seems to me that path and path2 are corrupted?
What I'm also unsure about is why line 35 is entered while stepping 
through the code - a gdb issue I can forget about?

Thanks,
Volker





More information about the grass-dev mailing list