Opened 12 years ago

Last modified 12 years ago

#34470 assigned defect

xgraph segmentation fault

Reported by: jursonovicst@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.1.0
Keywords: Cc:
Port: xgraph

Description (last modified by ryandesign (Ryan Carsten Schmidt))

xgraph -device ps -o test2-ps test.data
Segmentation fault: 11

Could you apply the segmentation fault solution described by http://djconnel.blogspot.de/2012/03/installing-xgraph-on-mac-osx-lion.html, please?

But then I faced a tougher problem: I was getting a persistent segmentation fault when I ran it. gdb wasn't turning up the problem, either.

The clue was in the compiler warnings: xgraph plays fast and loose with casting between addresses and integers. Sometimes that works, sometimes... So in desperation I checked the gcc man page and started reading, looking for an option which treated all integers as longs. I didn't think this would work, because external libraries might not cooperate.

I didn't find it. But what I found instead was the "-m32" option to compile the code in 32-bit mode even on a 64-bit machine. Hmm... seemed promising. I added this to the head of the "CFLAGS" definition in Makefile (Makefile having been generated with "configure", so this isn't the best approach). I tried it and, ding-ding-ding-ding, the code ran. My little victory shout was probably out of place, since I was on Caltrain at the time...

So now it works.

Thank you for fixing the build issue yesterday...

Tamás

Attachments (3)

xgraph.diff (591 bytes) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.
test.dat (4.7 KB) - added by jursonovicst@… 12 years ago.
test file for xgraph
xgraph_output.jpg (39.1 KB) - added by jursonovicst@… 12 years ago.
xgraph reference output

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: changed from macports-tickets@… to ryandesign@…
Status: newassigned

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: xgraph.diff added

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

In r93163 I fixed xgraph so that it respects -arch flags. I turned off the universal variant because it failed to build.

I've attached a patch to force the port to build 32-bit. I haven't committed it because xgraph still crashes for me. Does it work for you with this patch? If so, perhaps I just don't know how to use xgraph; please show me the command you used and let me know where to get any necessary data files.

Changed 12 years ago by jursonovicst@…

Attachment: test.dat added

test file for xgraph

Changed 12 years ago by jursonovicst@…

Attachment: xgraph_output.jpg added

xgraph reference output

comment:3 Changed 12 years ago by jursonovicst@…

Hi ryandesign,

I've uploaded two files for testing xgraph.

Command $ xgraph test.dat should display an x-window application (xgraph_output.jpg) but the segmentation fault is caused by: $ xgraph -device ps -o test2.ps test.dat. I'm really sorry but I do not know hot to apply your patch. Could you check for me, please?

Thank you, T.

comment:4 in reply to:  3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to jursonovicst@…:

I've uploaded two files for testing xgraph.

Thanks.

Command $ xgraph test.dat should display an x-window application (xgraph_output.jpg)

Yes, that works, regardless whether I build i386 or x86_64.

but the segmentation fault is caused by: $ xgraph -device ps -o test2.ps test.dat.

Yes, I confirm that too. With x86_64 it's a segmentation fault; with i386 it's a bus error, but either way, that's a crash.

I'm really sorry but I do not know hot to apply your patch.

If you'd like to try it yourself, download the patch, then do this:

cd $(port dir xgraph)
sudo port clean
sudo patch < ~/Downloads/xgraph.diff
sudo port install
Note: See TracTickets for help on using tickets.