Opened 12 years ago

Closed 12 years ago

#34520 closed defect (fixed)

dia crashes on start

Reported by: luc_j_bourhis@… Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version: 2.1.1
Keywords: Cc: cumhur.erkut@…, pierre.riou@…, diekhans (Mark Diekhans), paul@…, ewen-naos-nz (Ewen McNeill), su-v, 4eppelin@…, sebastic@…, jrw429, dcecchin@…, jere@…, pokui@…, bradnull@…, asnedden@…
Port: dia

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

With a freshly installed MacPorts on MacOS 10.7.4 with Xcode 4.3.2, do

  > sudo port install dia

then launch

  > dia

A window appears for a short while before the program crashes with

Segmentation fault: 11

Running it with gdb gives

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000007a950f48
0x00007fff94df91ec in flockfile ()
(gdb) bt
#0  0x00007fff94df91ec in flockfile ()
#1  0x00007fff94daeb23 in fread ()
#2  0x00000001034901d5 in shape_typeinfo_load ()
#3  0x0000000103494031 in load_shapes_from_tree ()
#4  0x0000000103493f95 in load_shapes_from_tree ()
#5  0x0000000103493f32 in dia_plugin_init ()
#6  0x00000001000c8a34 in dia_plugin_load ()
#7  0x00000001000c8dfa in dia_register_plugin ()
#8  0x00000001000c8f29 in for_each_in_dir ()
#9  0x00000001000c9112 in dia_register_plugins ()
#10 0x00000001000105d5 in app_init ()
#11 0x000000010003a539 in main ()

Attachments (4)

Change History (35)

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

Description: modified (diff)

comment:2 Changed 12 years ago by luc_j_bourhis@…

Forgot port version: dia @0.97.2, Revision 1 (gnome, graphics)

comment:3 Changed 12 years ago by cumhur.erkut@…

Same problem with @0.97.2, Revision 1 on an older system OSX 10.6.8 and XCode 4.2

comment:4 Changed 12 years ago by cumhur.erkut@…

Cc: cumhur.erkut@… added

Cc Me!

comment:5 Changed 12 years ago by mf2k (Frank Schima)

Keywords: segfault removed

comment:6 Changed 12 years ago by detlevd (Detlev Droege)

Same here (10.7.4, XCode 4.2). Compiled with -g, ran gdb: crash occurs on first call of shape_typeinfo_load() which tries to open

/opt/local/share/dia/shapes/Assorted/arrow-chevron.shape

which exists and is world readable. g_fopen() seems successful, but first call of fread() causes the crash.

comment:7 Changed 12 years ago by pierre.riou@…

Cc: pierre.riou@… added

Cc Me!

comment:8 Changed 12 years ago by diekhans (Mark Diekhans)

Cc: markd@… added

Cc Me!

comment:9 Changed 12 years ago by paul@…

Cc: paul@… added

Cc Me!

comment:10 Changed 12 years ago by ewen-naos-nz (Ewen McNeill)

Cc: macports@… added

Cc Me!

comment:11 Changed 12 years ago by ewen-naos-nz (Ewen McNeill)

0.97.2_1 also crashes on startup for me (creating a 350MB core file, if I let it; my backtrace looks identical to the one on the ticket), on OS X 10.6.8.

If I reactivate 0.97.2_0, and fudge a backwards compatibility symlink for a library that got upgraded since I built 0.97.2_0:

ewen@bethel:~$ dia FILE.dia
dyld: Library not loaded: /opt/local/lib/libffi.5.dylib
  Referenced from: /opt/local/bin/dia
  Reason: image not found
Trace/BPT trap
ewen@bethel:~$

with

ewen@bethel:~$ cd /opt/local/lib
ewen@bethel:/opt/local/lib$ sudo ln -s libffi.6.dylib libffi.5.dylib

then dia will start up and load my file.

The difference between 0.97.2_0 and 0.97.2_1 is one changeset r90852, in response to ticket #33616, which adds in a forced use of a SVG library. Given the way it crashes (after a long time reading in lots of data) I wonder if the issue is that it's then trying to use the SVG library to load a non-SVG thing?

The other possibility is that it has to do with environment at the built time (eg, compiler, etc). But it looks like something is wrong with the argument to fread() and/or flockfile(), particularly since in trying to grab a stack trace I'm seeing the segmentation fault happen _before_ it appears to stat/open the first shape file (based on trying to use dtruss, but after it's read in the directory). I guess the idea would be to try to rebuild _1 with that library disabled again, and see if it makes it work again.

comment:12 Changed 12 years ago by su-v

Crash reproduced with dia 0.97.2_1 on OS X 10.7.4 (Xcode 4.3.2).

After rebuilding dia using the latest patches from the 0.97 git branch it no longer crashes on launch and seems to work ok (I only did some quick tests).

Attaching unified Portfile diff and the three patch files.

Changed 12 years ago by su-v

Attachment: Portfile-dia.diff added

comment:13 Changed 12 years ago by su-v

Cc: suv-sf@… added

Cc Me!

comment:14 Changed 12 years ago by ewen-naos-nz (Ewen McNeill)

On OS X 10.6.8, I can confirm that a simple rebuild from source of dia 0.97.2_1 from source wasn't sufficient to make it work again (viz "sudo port clean dia; sudo port upgrade -s -n --force dia" -- it still crashed on startup), but a rebuild with the four patches attached by suv-sf (two weeks ago), with:

cd /opt/local/var/macports/sources/rsync.macports.org/release/ports/gnome/dia/files
sudo cp -p ~ewen/Desktop/*.patch .
cd ..
sudo patch -p0 <~ewen/Desktop/Portfile-dia.diff
sudo port upgrade -s -n --force dia

resulted in an 0.97.2_2 (the _2 is in the Portfile-dia.diff), which would start successfully and load an existing dia diagram. So it appears actual code had to change, not just a binary structure change to match other things being recompiled.

The first attached patch (0001-...) appears to be this patch for font issue 668587, which is presumably the fix (although the gnome bug report seems to be originally triggered in a different way in Debian). The other two seem to be compile-time issues relating to headers not always being included.

So a local (MacPorts) inclusion of at least the first patch seems likely to resolve this bug. It'd be helpful if it had a local revision bump higher than _2.

Ewen

comment:15 in reply to:  14 Changed 12 years ago by su-v

Replying to macports@…:

So a local (MacPorts) inclusion of at least the first patch seems likely to resolve this bug.

1) Building with patch 0001 only fails (to be expected - the changes for the glib headers is required for MacPorts version of glib2).

2) Building with patch 0002 only succeeds, and dia opens without crash.

3) Building with patch 0002 and 0003 succeeds, and dia opens without crash.

--> the minimum changes appear to be in the upstream version of the patch to make dia compatible with glib2 >= 2.31 (see also upstream bug 665335). The other two (0001, 0003) appear to be bonus fixes not yet available in a stable bug-fix release of Dia 0.97.

It'd be helpful if it had a local revision bump higher than _2.

Why? Incrementing the revision by 1 is according to the guide.

comment:16 Changed 12 years ago by ewen-naos-nz (Ewen McNeill)

Thanks for testing the combinations. I am surprised that a change in include files only is sufficient fix, given that I could rebuild the _1 version without that change, but with the same versions of other packages installed. Perhaps the compiler was making assumptions about other things not included.

FWIW, my suggestion to bump the local revision higher than _2 was simply because there is now an "unofficial" 0.97.2_2 that multiple people have installed, and it'd be less confusing if the next official version didn't have that same number (as well as meaning that people with that installed could get back to the official build by just doing an upgrade).

Ewen

comment:17 Changed 12 years ago by 4eppelin@…

Cc: 4eppelin@… added

Cc Me!

comment:18 Changed 12 years ago by sebastic@…

Cc: sebastic@… added

Cc Me!

comment:19 Changed 12 years ago by jrw429

Cc: jwright@… added

Cc Me!

comment:20 Changed 12 years ago by dcecchin@…

Cc: dcecchin@… added

Cc Me!

comment:21 Changed 12 years ago by dcecchin@…

Cc: dcecchin@… removed

Cc Me!

comment:22 Changed 12 years ago by dcecchin@…

Cc: dcecchin@… added

Cc Me!

comment:23 Changed 12 years ago by dcecchin@…

Same thing happens on a fresh install of Mac OSX 10.8

comment:24 Changed 12 years ago by jere@…

Cc: jere@… added

Cc Me!

comment:25 Changed 12 years ago by pokui@…

Cc: pokui@… added

Cc Me!

comment:26 Changed 12 years ago by bradnull@…

Cc: bradnull@… added

Cc Me!

comment:27 Changed 12 years ago by asnedden@…

Is there a way to utilize these patch file while building from Mac Ports? Or are these patch files solely for developer purposes or folks installing from source? Thanks!

comment:28 Changed 12 years ago by asnedden@…

Cc: asnedden@… added

Cc Me!

comment:29 in reply to:  27 Changed 12 years ago by ewen-naos-nz (Ewen McNeill)

Replying to asnedden@…:

Is there a way to utilize these patch file while building from Mac Ports? Or are these patch files solely for developer purposes or folks installing from source? Thanks!

If you build the dia port from source, then you can use the patches by downloading them all and then copying them into the port directory, eg, as I described a few weeks back on this ticket. (That description includes the command to force dia to be rebuilt from the patched source.)

Beware that the "port selfupdate" rsync process will remove the patch changes from that directory, so you'll need to reapply the patches if you do "port selfupdate" and then want to build dia again. The easiest thing is to do the "port selfupdate" first, then do the patch/build process for dia, then stick with that working dia. (Presumably any later update to dia will be a version including the fix anyway.)

Ewen

comment:30 Changed 12 years ago by drkp (Dan Ports)

Owner: changed from macports-tickets@… to dports@…
Status: newassigned

comment:31 Changed 12 years ago by drkp (Dan Ports)

Resolution: fixed
Status: assignedclosed

Committed in r96990.

I was expecting patch 0001 to be enough, in combination with the existing patch for glib, but that didn't work, so I committed all three.

Note: See TracTickets for help on using tickets.