Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Segfaults trying to open any gif #180

Closed
Fuuzetsu opened this issue Oct 21, 2014 · 13 comments
Closed

Segfaults trying to open any gif #180

Fuuzetsu opened this issue Oct 21, 2014 · 13 comments

Comments

@Fuuzetsu
Copy link

sxiv foo.gif just results in a segfault straight away

#0  0x00007ffff73dd176 in DGifCloseFile () from /nix/store/3r740a987zz3siha1zk7dkmh46jldy4m-giflib-5.1.0/lib/libgif.so.7
#1  0x00007fffed945463 in load () from /nix/store/8xwqsl5p81x7ffbi14yald01abh45mxc-imlib2-1.4.6/lib/imlib2/loaders/gif.so
#2  0x00007ffff784c6bc in __imlib_LoadImage () from /nix/store/8xwqsl5p81x7ffbi14yald01abh45mxc-imlib2-1.4.6/lib/libImlib2.so.1
#3  0x00007ffff78301b1 in imlib_load_image () from /nix/store/8xwqsl5p81x7ffbi14yald01abh45mxc-imlib2-1.4.6/lib/libImlib2.so.1
#4  0x0000000000405fdb in img_load (img=0x613a80 <img>, file=0x614010) at image.c:322
#5  0x0000000000408532 in load_image (new=0) at main.c:328
#6  0x000000000040a32d in main (argc=2, argv=0x7fffffffd9b8) at main.c:888
@Fuuzetsu
Copy link
Author

Forgot to say, this is at rev c33f2ad

@xyb3rt
Copy link
Owner

xyb3rt commented Oct 22, 2014

I can not reproduce this.

@Fuuzetsu
Copy link
Author

Do you have tips for debugging this?

If you use the nix package manager then I could probably provide a closure of the build although I don't have my hopes up here.

@xyb3rt
Copy link
Owner

xyb3rt commented Oct 22, 2014

Did you by any chance rebuild or update imlib2 or giflib without rebuilding sxiv?

@Fuuzetsu
Copy link
Author

No, this was a fresh build. The same problem occurs on latest stable release (which is why I tried git) and if any of the dependencies change anywhere along the line, sxiv is rebuilt by our distro's buildbot.

Latest stable build: http://hydra.nixos.org/build/16419424
You can see the exact dependencies used at http://hydra.nixos.org/build/16419424#tabs-build-deps

For the git build, I added libexif on top of course.

@xyb3rt
Copy link
Owner

xyb3rt commented Oct 22, 2014

I think the problem is not caused by sxiv. While looking at your imlib2 package (https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/imlib2/default.nix) I noticed that it is build with libungif, whereas in the above stack trace the DGifCloseFile function from the giflib library is called. As of version 5.1.0 of that library, the DGifCloseFile function expects a second parameter, which is not provided by any call from vanilla imlib2 1.4.6.

@Fuuzetsu
Copy link
Author

So are you saying imlib2 is the culprit here? imlib2 1.4.6 is the latest release so I don't understand how to proceed here. Should we be using older giflib such as 5.0 until imlib2 can update?

@Fuuzetsu
Copy link
Author

OK, I can confirm that I can open some gifs when using giflib 5.0, although a huge number just gives me ‘could not open image’ warning.

I find it strange that there's code in sxiv to handle the new giflib 5.1 API but its other dependency can't work with it.

Fuuzetsu added a commit to Fuuzetsu/nixpkgs that referenced this issue Oct 22, 2014
@xyb3rt
Copy link
Owner

xyb3rt commented Oct 22, 2014

Maybe you should not use libungif at build time and giflib at run time. And then you can either use an older version of giflib or patch imlib2. As is beeing done for sxiv, btw: the current stable release (1.2) does not yet honor the API changes in giflib, too.

@Fuuzetsu
Copy link
Author

OK, I will worry about this again at the next release, for now using older giflib will have to do.

I will close this issue but it would be great if you could put a couple of words about this in the dependencies part of the readme.

@xyb3rt
Copy link
Owner

xyb3rt commented Oct 22, 2014

Making sxiv requiring giflib 5.0 is not a proper fix, as sxiv is not the issue. The problem is caused by imlib2 beeing build with a different gif library than it is run against. You're just hiding instead of fixing the issue.
Also, sxiv works with any version of giflib, so that I do not see the need of mentioning this in it's readme.

@Fuuzetsu
Copy link
Author

OK, I understand. Thank you for your time, I will employ a fix on our end as soon as time allows.

@Fuuzetsu
Copy link
Author

Fuuzetsu commented Nov 3, 2014

FYI: I now migrated our imlib2 to use giflib and sxiv works great, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants