! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Ristretto fails to load bmp (libmagic gives wrong mime-type)
Status:
RESOLVED: FIXED
Product:
Ristretto
Component:
Application

Comments

Description Gokul Krishnan 2017-04-10 19:10:25 CEST
Since 0.8.2, Ristretto does not load any bitmap (*.bmp) images. There is no error message or log in the terminal. 0.8.1 was able to load bitmaps fine. I've tested both versions in Arch linux and Xubuntu 16.04.

I checked the code under debugger and found this is a regression introduced by libmagic support, added in this commit:
https://git.xfce.org/apps/ristretto/commit/?id=2640c26d9b5b4332db8230ba82337ff7d97fb0bd

It seems the mime-type returned by libmagic is not compatible with gtk pixbuf formats that it's checked against. Gtk expects 'image/bmp' but libmagic returns 'image/x-ms-bmp', or just 'application/octet-stream' in some cases.

Disabling libmagic and using the old GFileInfo code fixes it for me. Considering we use Gtk everywhere else, I feel it's consistent that we use GFileInfo here rather than a different library. Was there any specific reason why the switch to libmagic was necessary?
Comment 1 Bruno Jesus 2017-04-10 20:15:52 CEST
I can also confirm this issue.
Comment 2 Igor editbugs 2017-06-06 19:03:10 CEST
Hi, thanks for reporting this!

The reason for introducing libmagic was that GFileInfo determines image type based on the file extension, and in case they do not match (e.g. a JPEG image stored in a *.png file), the image would fail to open. libmagic solves this problem.

However, it seems I need to look into how to handle cases when libmagic fails to properly determine MIME type.
Comment 3 Igor editbugs 2017-06-07 21:31:53 CEST
Since libmagic seems to be only using "image/x-ms-bmp" for BMP files (https://github.com/file/file/blob/898f5d27b66b5d5592cb56fa9da5b776628ea6ca/magic/Magdir/images#L553), I've decided to just replace this string with "image/bmp" that GTK understand.
Please let me know if there any issues.

Fixed by https://git.xfce.org/apps/ristretto/commit/?id=751834055dfc8831bfe06ed5e493c69b8347668a

Bug #13489

Reported by:
Gokul Krishnan
Reported on: 2017-04-10
Last modified on: 2017-06-07

People

CC List:
1 user

Version

Attachments

Additional information