[GRASS5] [bug #830] (grass) v.make.subj segmentation fault

this bug's URL: http://intevation.de/rt/webrt?serial_num=830
-------------------------------------------------------------------------

Subject: v.make.subj segmentation fault

Platform: NetBSD/i386
Xwindows version: Xfree 3.3.6
Xwindows manager: Enlightment
TclTk version: tcl/tk 8.3
grass downloaded at: Baylor site
grass binary for platform: I compiled the sources myself
grass sources source: no, I got a source code package from the server, 5.0.0pre2
c compiler name: gcc

This is the output from v.make.subj when I try to run it on 4 vector layers.

GRASS:/u0 > v.make.subj map=83d065_tctr,83d066_tctr,83d075_tctr,83d076_tctr subj=SUBJ/tctr

    Reading category file 83d065_tctr
           Adding new categ. : 101
    Reading category file 83d066_tctr

    Reading category file 83d075_tctr

    Reading category file 83d076_tctr
104
        SUBJect category processing finished
          104 categorie(s) added
Segmentation fault (core dumped)

Thanks,
  Dave

-------------------------------------------- Managed by Request Tracker

On Sat, Nov 10, 2001 at 01:03:05AM +0100, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=830
-------------------------------------------------------------------------

Subject: v.make.subj segmentation fault

Platform: NetBSD/i386
Xwindows version: Xfree 3.3.6
Xwindows manager: Enlightment
TclTk version: tcl/tk 8.3
grass downloaded at: Baylor site
grass binary for platform: I compiled the sources myself
grass sources source: no, I got a source code package from the server, 5.0.0pre2
c compiler name: gcc

This is the output from v.make.subj when I try to run it on 4 vector layers.

GRASS:/u0 > v.make.subj map=83d065_tctr,83d066_tctr,83d075_tctr,83d076_tctr subj=SUBJ/tctr

    Reading category file 83d065_tctr
           Adding new categ. : 101
    Reading category file 83d066_tctr

    Reading category file 83d075_tctr

    Reading category file 83d076_tctr
104
        SUBJect category processing finished
          104 categorie(s) added
Segmentation fault (core dumped)

Thanks,
  Dave

The problem is here:
src.contrib/SCS/vector/v.make.subj/cmd/main.c
the qsort() line crashes for "cmd" (which is again a function).

No idea how to fix this... Anyone else?

Ciao

Markus

Markus Neteler wrote:

The problem is here:
src.contrib/SCS/vector/v.make.subj/cmd/main.c
the qsort() line crashes for "cmd" (which is again a function).

No idea how to fix this... Anyone else?

The pointers need to be cast and dereferenced, i.e.

  return strcmp(*(const char **) a, *(const char **) b);

I'll commit a fix.

--
Glynn Clements <glynn.clements@virgin.net>