Segmentation Fault (Problem description and fix)

Clifton Wood cbwood at
Wed May 20 11:15:12 EDT 1998

I recently compiled Grass 4.2.1 on a Sun UltraSPARC running Solaris 2.6, 
after the compile completed successfully, I tried running
to output a sample map I had created. What I got, however, after all 
of the interactive questions were answered was a Segmentation Fault.

I was just about ready to report this to the list yesterday, when on a
lark, I decided to add -g to all libs and objects involved in the
binary. Surprisingly enough, the problem was found and resolved rather

Here's the diff which gets me a WORKING, however the problem
resides in libgis.a!

*** src421/libes/gis/strip.c     Tue May 19 17:58:54 1998
--- src421/libes/gis/strip.c.orig        Wed May 20 11:09:06 1998
*** 20,26 ****
  /* remove trailing white space */
      for (a = buf; *a; a++)
!     if ((a != buf) && *a)
        for (a--; *a == ' ' || *a == '\t'; a--)
--- 20,26 ----
  /* remove trailing white space */
      for (a = buf; *a; a++)
!     if (a != buf)
        for (a--; *a == ' ' || *a == '\t'; a--)

This patch was derived from the GRASS 4.2.1 (V.13) sources. I realize
(V.15) is
out, however I just haven't had the time to download and compile that
yet to see if this bug is there.

Hope this works for other people out there. Let me know if anyone has
questions (although this should be fairly straight forward.

Clifton B. Wood
Programmer/Analyst for Virginia Tech's AGNIS Department
-------------------- Thought of the Day --------------------
windows95 = n.  32 bit extensions and a graphical shell for
a 16 bit patch to an 8 bit operating system originally coded
for a 4 bit microprocessor, written by a 2 bit company that 
can't stand 1 bit of competition.

More information about the grass-user mailing list