[GRASS5] d.vect: new segfault

Florian,

I had to make the following change to d.vect to get
it compiled on RH7/gcc 2.9x. It complained about the
position of the declaration.

Unfortunately d.vect no longer works on RHEL 3... Sigh.

d.vect help
Segmentation fault

GRASS 5.7.cvs:~ > gdb `which d.vect `
GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
(gdb) r help
Starting program: /hardmnt/thuille0/ssi/software/cvsgrass57/dist.i686-pc-linux-gnu/bin/d.vect help

Program received signal SIGSEGV, Segmentation fault.
0x00373049 in _int_free () from /lib/tls/libc.so.6
(gdb) bt
#0 0x00373049 in _int_free () from /lib/tls/libc.so.6
#1 0x00373794 in _int_realloc () from /lib/tls/libc.so.6
#2 0x00372136 in realloc () from /lib/tls/libc.so.6
#3 0x00279d0b in G_realloc (buf=0x92e86c8, n=412) at alloc.c:87
#4 0x0804c525 in icon_files () at main.c:83
#5 0x0804c727 in main (argc=2, argv=0xbfff8014) at main.c:167

nl main.c | head -110 | tail -3
    82
    83 closedir(dir_i);
    84 closedir(dir);

I'm lost again...

Markus

On Wed, Dec 15, 2004 at 09:37:23AM +0100, grass@intevation.de wrote:

Author: markus

Update of /grassrepository/grass51/display/d.vect
In directory doto:/tmp/cvs-serv20407

Modified Files:
  main.c
Log Message:
fixed declaration position for gcc < 3.x

Index: main.c

RCS file: /grassrepository/grass51/display/d.vect/main.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- main.c 14 Dec 2004 20:43:40 -0000 1.45
+++ main.c 15 Dec 2004 08:37:21 -0000 1.46
@@ -57,6 +57,10 @@
     for (;:wink: { /*loop over each directory in etc/symbols*/
     
       struct dirent *di = readdir(dir_i);
+ int ni = 0;
+ char *buf = NULL;
+ char *buf2 = NULL;
+ char *buf3 = NULL;

       if (!di)
       break;
@@ -64,10 +68,6 @@
       if (di->d_name[0] == '.')
         continue;
       
- int ni = 0;
- char *buf = NULL;
- char *buf2 = NULL;
- char *buf3 = NULL;
       ni = strlen(di->d_name);
       buf = G_realloc(buf,(strlen(d->d_name) + ni + 1));
       buf2 = G_realloc(buf2,strlen(d->d_name));

On 15 Dec 2004, at 09:48, Markus Neteler wrote:

Unfortunately d.vect no longer works on RHEL 3... Sigh.

i already tested them. on debian (gcc 3.3.4) and osx they still work. however, i get an error if i compile d.vect before your patch on debian using gcc 2.95. i'll try to fix it.

regards

markus

it seems to me, that gcc 2.95 simple won't accept any declaration after the first control sequence call, thus doesn't work with my patch of d.vect.
as debian and osx both work with the changes you applied, i don't have any non-working platform.
i'm as lost as you, sorry.

regards
florian

PS: how do you get gdb working? when i want to use it, it complains about not finding debugging flags although i compiled with -g and -ggdb.

On 15 Dec 2004, at 09:48, Markus Neteler wrote:

Florian,

I had to make the following change to d.vect to get
it compiled on RH7/gcc 2.9x. It complained about the
position of the declaration.

Unfortunately d.vect no longer works on RHEL 3... Sigh.

d.vect help
Segmentation fault

GRASS 5.7.cvs:~ > gdb `which d.vect `
GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
(gdb) r help
Starting program: /hardmnt/thuille0/ssi/software/cvsgrass57/dist.i686-pc-linux-gnu/bin/d.vect help

Program received signal SIGSEGV, Segmentation fault.
0x00373049 in _int_free () from /lib/tls/libc.so.6
(gdb) bt
#0 0x00373049 in _int_free () from /lib/tls/libc.so.6
#1 0x00373794 in _int_realloc () from /lib/tls/libc.so.6
#2 0x00372136 in realloc () from /lib/tls/libc.so.6
#3 0x00279d0b in G_realloc (buf=0x92e86c8, n=412) at alloc.c:87
#4 0x0804c525 in icon_files () at main.c:83
#5 0x0804c727 in main (argc=2, argv=0xbfff8014) at main.c:167

nl main.c | head -110 | tail -3
    82
    83 closedir(dir_i);
    84 closedir(dir);

I'm lost again...

Markus

On Wed, Dec 15, 2004 at 09:37:23AM +0100, grass@intevation.de wrote:

Author: markus

Update of /grassrepository/grass51/display/d.vect
In directory doto:/tmp/cvs-serv20407

Modified Files:
  main.c
Log Message:
fixed declaration position for gcc < 3.x

Index: main.c

RCS file: /grassrepository/grass51/display/d.vect/main.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- main.c 14 Dec 2004 20:43:40 -0000 1.45
+++ main.c 15 Dec 2004 08:37:21 -0000 1.46
@@ -57,6 +57,10 @@
     for (;:wink: { /*loop over each directory in etc/symbols*/
     
       struct dirent *di = readdir(dir_i);
+ int ni = 0;
+ char *buf = NULL;
+ char *buf2 = NULL;
+ char *buf3 = NULL;

       if (!di)
       break;
@@ -64,10 +68,6 @@
       if (di->d_name[0] == '.')
         continue;

- int ni = 0;
- char *buf = NULL;
- char *buf2 = NULL;
- char *buf3 = NULL;
       ni = strlen(di->d_name);
       buf = G_realloc(buf,(strlen(d->d_name) + ni + 1));
       buf2 = G_realloc(buf2,strlen(d->d_name));

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Florian,

sorry to say, but then we have to revert it (also d.m if needed).
d.vect is an essential program and must work on all
platforms.

To make it working for now, I have commented the
line:
/* icon_opt->options = icon_files();*/

in CVS.

Please comment/revert d.m accordingly if needed.

Maybe Glynn is willing to look at the icon_files() function?

Markus

On Wed, Dec 15, 2004 at 05:46:10PM +0100, Florian Goessmann wrote:

markus

it seems to me, that gcc 2.95 simple won't accept any declaration after
the first control sequence call, thus doesn't work with my patch of
d.vect.
as debian and osx both work with the changes you applied, i don't have
any non-working platform.
i'm as lost as you, sorry.

regards
florian

PS: how do you get gdb working? when i want to use it, it complains
about not finding debugging flags although i compiled with -g and
-ggdb.

On 15 Dec 2004, at 09:48, Markus Neteler wrote:

>Florian,
>
>I had to make the following change to d.vect to get
>it compiled on RH7/gcc 2.9x. It complained about the
>position of the declaration.
>
>Unfortunately d.vect no longer works on RHEL 3... Sigh.
>
>d.vect help
>Segmentation fault
>
>GRASS 5.7.cvs:~ > gdb `which d.vect `
>GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
>(gdb) r help
>Starting program:
>/hardmnt/thuille0/ssi/software/cvsgrass57/dist.i686-pc-linux-gnu/bin/
>d.vect help
>
>Program received signal SIGSEGV, Segmentation fault.
>0x00373049 in _int_free () from /lib/tls/libc.so.6
>(gdb) bt
>#0 0x00373049 in _int_free () from /lib/tls/libc.so.6
>#1 0x00373794 in _int_realloc () from /lib/tls/libc.so.6
>#2 0x00372136 in realloc () from /lib/tls/libc.so.6
>#3 0x00279d0b in G_realloc (buf=0x92e86c8, n=412) at alloc.c:87
>#4 0x0804c525 in icon_files () at main.c:83
>#5 0x0804c727 in main (argc=2, argv=0xbfff8014) at main.c:167
>
>nl main.c | head -110 | tail -3
> 82
> 83 closedir(dir_i);
> 84 closedir(dir);
>
>I'm lost again...
>
>Markus
>
>On Wed, Dec 15, 2004 at 09:37:23AM +0100, grass@intevation.de wrote:
>>Author: markus
>>
>>Update of /grassrepository/grass51/display/d.vect
>>In directory doto:/tmp/cvs-serv20407
>>
>>Modified Files:
>> main.c
>>Log Message:
>>fixed declaration position for gcc < 3.x
>>
>>Index: main.c
>>===================================================================
>>RCS file: /grassrepository/grass51/display/d.vect/main.c,v
>>retrieving revision 1.45
>>retrieving revision 1.46
>>diff -u -d -r1.45 -r1.46
>>--- main.c 14 Dec 2004 20:43:40 -0000 1.45
>>+++ main.c 15 Dec 2004 08:37:21 -0000 1.46
>>@@ -57,6 +57,10 @@
>> for (;:wink: { /*loop over each directory in etc/symbols*/
>>
>> struct dirent *di = readdir(dir_i);
>>+ int ni = 0;
>>+ char *buf = NULL;
>>+ char *buf2 = NULL;
>>+ char *buf3 = NULL;
>>
>> if (!di)
>> break;
>>@@ -64,10 +68,6 @@
>> if (di->d_name[0] == '.')
>> continue;
>>
>>- int ni = 0;
>>- char *buf = NULL;
>>- char *buf2 = NULL;
>>- char *buf3 = NULL;
>> ni = strlen(di->d_name);
>> buf = G_realloc(buf,(strlen(d->d_name) + ni + 1));
>> buf2 = G_realloc(buf2,strlen(d->d_name));
>
>_______________________________________________
>grass5 mailing list
>grass5@grass.itc.it
>http://grass.itc.it/mailman/listinfo/grass5
>

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

didn't you get my email yesterday, in which i suggested that?

On 17 Dec 2004, at 12:14, Markus Neteler wrote:

Florian,

sorry to say, but then we have to revert it (also d.m if needed).
d.vect is an essential program and must work on all
platforms.

To make it working for now, I have commented the
line:
/* icon_opt->options = icon_files();*/

in CVS.

Please comment/revert d.m accordingly if needed.

Maybe Glynn is willing to look at the icon_files() function?

Markus

On Wed, Dec 15, 2004 at 05:46:10PM +0100, Florian Goessmann wrote:

markus

it seems to me, that gcc 2.95 simple won't accept any declaration after
the first control sequence call, thus doesn't work with my patch of
d.vect.
as debian and osx both work with the changes you applied, i don't have
any non-working platform.
i'm as lost as you, sorry.

regards
florian

PS: how do you get gdb working? when i want to use it, it complains
about not finding debugging flags although i compiled with -g and
-ggdb.

On 15 Dec 2004, at 09:48, Markus Neteler wrote:

Florian,

I had to make the following change to d.vect to get
it compiled on RH7/gcc 2.9x. It complained about the
position of the declaration.

Unfortunately d.vect no longer works on RHEL 3... Sigh.

d.vect help
Segmentation fault

GRASS 5.7.cvs:~ > gdb `which d.vect `
GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
(gdb) r help
Starting program:
/hardmnt/thuille0/ssi/software/cvsgrass57/dist.i686-pc-linux-gnu/bin/
d.vect help

Program received signal SIGSEGV, Segmentation fault.
0x00373049 in _int_free () from /lib/tls/libc.so.6
(gdb) bt
#0 0x00373049 in _int_free () from /lib/tls/libc.so.6
#1 0x00373794 in _int_realloc () from /lib/tls/libc.so.6
#2 0x00372136 in realloc () from /lib/tls/libc.so.6
#3 0x00279d0b in G_realloc (buf=0x92e86c8, n=412) at alloc.c:87
#4 0x0804c525 in icon_files () at main.c:83
#5 0x0804c727 in main (argc=2, argv=0xbfff8014) at main.c:167

nl main.c | head -110 | tail -3
   82
   83 closedir(dir_i);
   84 closedir(dir);

I'm lost again...

Markus

On Wed, Dec 15, 2004 at 09:37:23AM +0100, grass@intevation.de wrote:

Author: markus

Update of /grassrepository/grass51/display/d.vect
In directory doto:/tmp/cvs-serv20407

Modified Files:
  main.c
Log Message:
fixed declaration position for gcc < 3.x

Index: main.c

RCS file: /grassrepository/grass51/display/d.vect/main.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- main.c 14 Dec 2004 20:43:40 -0000 1.45
+++ main.c 15 Dec 2004 08:37:21 -0000 1.46
@@ -57,6 +57,10 @@
    for (;:wink: { /*loop over each directory in etc/symbols*/
    
      struct dirent *di = readdir(dir_i);
+ int ni = 0;
+ char *buf = NULL;
+ char *buf2 = NULL;
+ char *buf3 = NULL;

      if (!di)
      break;
@@ -64,10 +68,6 @@
      if (di->d_name[0] == '.')
        continue;

- int ni = 0;
- char *buf = NULL;
- char *buf2 = NULL;
- char *buf3 = NULL;
      ni = strlen(di->d_name);
      buf = G_realloc(buf,(strlen(d->d_name) + ni + 1));
      buf2 = G_realloc(buf2,strlen(d->d_name));

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy

On Fri, Dec 17, 2004 at 12:18:17PM +0100, Florian Goessmann wrote:

didn't you get my email yesterday, in which i suggested that?

Only now I have seen that personal mail.

So we agree :slight_smile:

Still searching for a VOLUNTEER EXPERT to fix the icon_files()
portability problems...

M

On 17 Dec 2004, at 12:14, Markus Neteler wrote:

>Florian,
>
>sorry to say, but then we have to revert it (also d.m if needed).
>d.vect is an essential program and must work on all
>platforms.
>
>To make it working for now, I have commented the
>line:
>/* icon_opt->options = icon_files();*/
>
>in CVS.
>
>Please comment/revert d.m accordingly if needed.
>
>Maybe Glynn is willing to look at the icon_files() function?
>
>Markus
>
>
>On Wed, Dec 15, 2004 at 05:46:10PM +0100, Florian Goessmann wrote:
>>markus
>>
>>it seems to me, that gcc 2.95 simple won't accept any declaration
>>after
>>the first control sequence call, thus doesn't work with my patch of
>>d.vect.
>>as debian and osx both work with the changes you applied, i don't have
>>any non-working platform.
>>i'm as lost as you, sorry.
>>
>>regards
>>florian
>>
>>PS: how do you get gdb working? when i want to use it, it complains
>>about not finding debugging flags although i compiled with -g and
>>-ggdb.
>>
>>On 15 Dec 2004, at 09:48, Markus Neteler wrote:
>>
>>>Florian,
>>>
>>>I had to make the following change to d.vect to get
>>>it compiled on RH7/gcc 2.9x. It complained about the
>>>position of the declaration.
>>>
>>>Unfortunately d.vect no longer works on RHEL 3... Sigh.
>>>
>>>d.vect help
>>>Segmentation fault
>>>
>>>GRASS 5.7.cvs:~ > gdb `which d.vect `
>>>GNU gdb Red Hat Linux (6.1post-1.20040607.17rh)
>>>(gdb) r help
>>>Starting program:
>>>/hardmnt/thuille0/ssi/software/cvsgrass57/dist.i686-pc-linux-gnu/bin/
>>>d.vect help
>>>
>>>Program received signal SIGSEGV, Segmentation fault.
>>>0x00373049 in _int_free () from /lib/tls/libc.so.6
>>>(gdb) bt
>>>#0 0x00373049 in _int_free () from /lib/tls/libc.so.6
>>>#1 0x00373794 in _int_realloc () from /lib/tls/libc.so.6
>>>#2 0x00372136 in realloc () from /lib/tls/libc.so.6
>>>#3 0x00279d0b in G_realloc (buf=0x92e86c8, n=412) at alloc.c:87
>>>#4 0x0804c525 in icon_files () at main.c:83
>>>#5 0x0804c727 in main (argc=2, argv=0xbfff8014) at main.c:167
>>>
>>>nl main.c | head -110 | tail -3
>>> 82
>>> 83 closedir(dir_i);
>>> 84 closedir(dir);
>>>
>>>I'm lost again...
>>>
>>>Markus
>>>
>>>On Wed, Dec 15, 2004 at 09:37:23AM +0100, grass@intevation.de wrote:
>>>>Author: markus
>>>>
>>>>Update of /grassrepository/grass51/display/d.vect
>>>>In directory doto:/tmp/cvs-serv20407
>>>>
>>>>Modified Files:
>>>> main.c
>>>>Log Message:
>>>>fixed declaration position for gcc < 3.x
>>>>
>>>>Index: main.c
>>>>===================================================================
>>>>RCS file: /grassrepository/grass51/display/d.vect/main.c,v
>>>>retrieving revision 1.45
>>>>retrieving revision 1.46
>>>>diff -u -d -r1.45 -r1.46
>>>>--- main.c 14 Dec 2004 20:43:40 -0000 1.45
>>>>+++ main.c 15 Dec 2004 08:37:21 -0000 1.46
>>>>@@ -57,6 +57,10 @@
>>>> for (;:wink: { /*loop over each directory in etc/symbols*/
>>>>
>>>> struct dirent *di = readdir(dir_i);
>>>>+ int ni = 0;
>>>>+ char *buf = NULL;
>>>>+ char *buf2 = NULL;
>>>>+ char *buf3 = NULL;
>>>>
>>>> if (!di)
>>>> break;
>>>>@@ -64,10 +68,6 @@
>>>> if (di->d_name[0] == '.')
>>>> continue;
>>>>
>>>>- int ni = 0;
>>>>- char *buf = NULL;
>>>>- char *buf2 = NULL;
>>>>- char *buf3 = NULL;
>>>> ni = strlen(di->d_name);
>>>> buf = G_realloc(buf,(strlen(d->d_name) + ni + 1));
>>>> buf2 = G_realloc(buf2,strlen(d->d_name));
>>>
>>>_______________________________________________
>>>grass5 mailing list
>>>grass5@grass.itc.it
>>>http://grass.itc.it/mailman/listinfo/grass5
>>>
>
>--
>Markus Neteler <neteler itc it> http://mpa.itc.it
>ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
>MPBA - Predictive Models for Biol. & Environ. Data Analysis
>Via Sommarive, 18 - 38050 Povo (Trento), Italy
>

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy