Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 8957 - xcircuit SIGSEGVs during startup
Summary: xcircuit SIGSEGVs during startup
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: George Shapovalov (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-09 22:40 UTC by Jonathan Nall
Modified: 2002-10-22 02:38 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch for SIGSEGV (xcircuit-2.5.4-badptrptr.patch,311 bytes, patch)
2002-10-09 22:41 UTC, Jonathan Nall
Details | Diff
modified ebuild (xcircuit-2.5.4.ebuild,1.06 KB, application/octet-stream)
2002-10-13 22:18 UTC, George Shapovalov (RETIRED)
Details
combined patch (xcircuit-2.5.4.patch,1.10 KB, patch)
2002-10-13 22:19 UTC, George Shapovalov (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Nall 2002-10-09 22:40:37 UTC
app-sci/xcircuit SIGSEGVs during startup. i've confirmed this on both x86 and
PPC. i'm attaching a patch that will fix this problem. the faulty code is

foo** bar;
*bar = malloc();

my solution is:
foo** bar;
foo* baz;
bar = &baz;
*bar = malloc();
Comment 1 Jonathan Nall 2002-10-09 22:41:32 UTC
Created attachment 4558 [details, diff]
patch for SIGSEGV
Comment 2 SpanKY gentoo-dev 2002-10-10 01:14:43 UTC
what a crazy hack :) 
Comment 3 Jonathan Nall 2002-10-10 07:27:57 UTC
not so crazy... i'm pretty sure it's what the author intended. 
let's talk in char's.

he made a char** called newinst. that's a pointer to a pointer to a char.
then he says *newinst = malloc(...). that says i'd like the thing that newinst
points to (a char*) to be assigned whatever malloc returns. but there's a
problem here. his declaration:
char** newinst;
doesn't initialize it's variable. let's say the compiler is nice and initializes
it to NULL. if that's the case,
*newinst = malloc(...);
is really saying
*(NULL) = malloc(...);
which is an obvious SIGSEGV.

all my patch does is create a char* and initialize newinst to the address of
that char*. this allows code like: *newinst = malloc(...) to work just fine.
Comment 4 George Shapovalov (RETIRED) gentoo-dev 2002-10-13 22:16:14 UTC
Hi Jonathan

Thanks for tracking the problem and the patch!
I tried the patch, however the compilation halts with a somewhat misterious
message (the modified code looks syntactically correct to me, but gcc apparently
thinks otherwise). Here is the tailing part:

gcc -DPACKAGE=\"xcircuit\" -DVERSION=\"2.5\" -DPROTOTYPES=1 -DHAVE_LIBM=1
-DHAVE_LIBXT=1 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1
-DHAVE_DIRENT_H=1 -DHAVE_U_CHAR=1 -DSCHEMA=1 -DSCHEM_FLAG=\"-schema\" -DLGF=1
-DINPUT_FOCUS=1 -DGS_EXEC=\"gs\" -DHAVE_PYTHON=1 -DHAVE_X11_XPM_H=1 -DHAVE_XPM=1
 -I. -I.  -IXw -DPROG_VERSION=2.5  -DTEMP_DIR=\"/tmp\"     
-DRESOURCES_DIR=\"/usr/share/xcircuit-2.5/app-defaults\"       
-DBUILTINS_DIR=\"/usr/share/xcircuit-2.5\"     -DBUILTINS_FILE=\"\"   
-DUSER_RC_FILE=\".xcircuitrc\"  -DPROLOGUE_DIR=\"/usr/share/xcircuit-2.5\"    
-DPROLOGUE_FILE=\"xcircps2.pro\"        -DSTARTUP_FILE=\"xcstartup.py\"        
-DLGF_LIB=\"lgf.lps\"  -I/usr/X11R6/include -DDOUBLEBUFFER
-I/usr/include/python2.2  -march=i686 -O2 -pipe -fforce-addr
-fomit-frame-pointer -funroll-loops -frerun-loop-opt -malign-functions=4 
-fexpensive-optimizations -ffast-math -c files.c
files.c: In function `objectread':
files.c:1977: parse error before `*'
files.c:2029: `newpath' undeclared (first use in this function)
files.c:2029: (Each undeclared identifier is reported only once
files.c:2029: for each function it appears in.)
files.c:2036: `startpoint' undeclared (first use in this function)
make[1]: *** [files.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/xcircuit-2.5.4/work/xcircuit-2.5.4'
make: *** [all-recursive] Error 1

The same happens without any optimizations. Could you please take a look?
I attach below the modofied ebuild and the patch (combining this bug and #8960)
Thanks!

George
Comment 5 George Shapovalov (RETIRED) gentoo-dev 2002-10-13 22:18:20 UTC
Created attachment 4686 [details]
modified ebuild
Comment 6 George Shapovalov (RETIRED) gentoo-dev 2002-10-13 22:19:11 UTC
Created attachment 4687 [details, diff]
combined patch
Comment 7 Jonathan Nall 2002-10-13 23:03:01 UTC
george, 
which version of gcc are you using? i just used your combined patch with your
modified ebuild and compilation completed without a hitch. i'm using gcc 3.2.
Comment 8 George Shapovalov (RETIRED) gentoo-dev 2002-10-14 22:45:36 UTC
Hi Jonathan

That was a quick way to find the problem, nice :).
I made this patch conditional on gcc version and the other one unconditional
(for the record: this patch is necessary on gcc-3.2 but breaks on 2.95.x). 
Please test the ebuild. I committed and masked it (I did not bump the revision
not to force the recompilation on platforms where it works now). 
To unmask, please remove '~' (tilda) in KEYWORDS inside the ebuild.
Please report the result, so I could unmask it.
Thanks for your work!

George
Comment 9 Jonathan Nall 2002-10-15 08:31:41 UTC
tested on PPC and x86 (both gcc 3.2 boxes)-- it works great on both architectures.
Comment 10 Jonathan Nall 2002-10-15 15:03:43 UTC
george,
i looked at the xcircuit-2.5.4 available from sourceforge.net and it's different
than the one on the gentoo mirror. specifically this section of code is
different. do you know what this is about?

i'm looking at xcircuit-2.5.4 as available from:
http://sourceforge.net/project/showfiles.php?group_id=4952

Comment 11 George Shapovalov (RETIRED) gentoo-dev 2002-10-15 15:27:31 UTC
Hi Jonathan.

Well, to tell the truth I have little idea why this is a different code than the
one on sourceforge. I wasn't the one who created/added this ebuild, so I
wouldn't really know its original whereabouts. According to Changelog Tod Neidt
might be able to tell little bit more about this. I added him to this bug.

Tod: could you please comment if you have any info on the question?


George
Comment 12 Tod M. Neidt (RETIRED) gentoo-dev 2002-10-15 19:22:08 UTC
Hi!

Perusing the manifest, it seems the developer of xcircuit makes multiple
releases with incremental changes using the same version number.  It also
appears that the offical homepage has changed to   http://xcircuit.ece.jhu.edu 
which should be updated in the ebuild.  the latest and greatest sources are
found at http://xcircuit.ece.jhu.edu/archive/     Incidentally, the latest
release is 3.0

You will notice that the 2.5.4 tarball is dated 14 May 2002 at the above archive
while the 2.5.4 version on sourceforge is dated  28 April 2002.  Incidentally, I
committed the original ebuild on 5 April 2002 with the src uri pointing to the
old homepage  (It worked fine then, honest :),  so there appears to be at least
three different flavors of 2.5.4 floating around.

I would update the HOMEPAGE and SRC_URI to http://xcircuit.ece.jhu.edu/ and
http://xcircuit.ece.jhu.edu/archive/ respectively as those seem to be the most
current and maintained. Would you mind updating that George, my box is not
developer enable at the moment. It doesn't appear that the sourceforge page is
kept current.

Sorry, for any confusion, I have be out of the saddle for a while and haven't
been able to track changes.

tod

P.S. might consider floating the patches upstream.





Comment 13 George Shapovalov (RETIRED) gentoo-dev 2002-10-15 22:52:15 UTC
Hi Tod

Thanks for clarification! 
I updated HOMEPAGE and SRC_URI in the present ebuild (the source seems to be the
same at least according to diff and md5 sums).
Most likely I'll take care of newer versions, as I am overseing app-sci as well
as couple of dev categories. Though this will have to wait since we are now in a
feature freeze. 
As for this issue: it seems to be resolved now, so I'll just wait for test
reports from ppc/gcc-2.95.3 people and close this bug, unless anythig else comes
up :).

George
Comment 14 George Shapovalov (RETIRED) gentoo-dev 2002-10-22 02:38:14 UTC
Closing the bug, as resolved and tested and no complaints within a week (still ~
in ppc, but I'll let ppc people remove it).

George