Bug#669562: libgdk-pixbuf2.0-0: fails to load some image files due to wrong detected mime type

Alexis Bienvenüe pado at passoire.fr
Thu Apr 19 20:13:12 UTC 2012


Package: libgdk-pixbuf2.0-0
Version: 2.26.1-1
Severity: normal

Dear Maintainer,

It appears that some PNG files I used couldn't be load by gdk_pixbuf_new_from_file,
because their mimetype was detected to be application/x-designer by g_content_type_guess,
although the mimetype command returns image/png for these files.

These files can be viewed without problem with for example eog or gimp, but can't be viewed
with geeqie.

The C program below returns

Mime: application/x-designer
test file load failure, error message: Couldn't recognize the image file format for file '2-7.png'

The file 2-7.png is a proper PNG file but has a content that matches the magic conditions
for application/x-designer in the /usr/share/mime/magic used by g_content_type_guess.

Perhaps a solution to solve the problem would be to let GDK_PIXBUF_USE_GIO_MIME undefined
(using gio_can_sniff=no in configure options?), but I don't know if this has drawbacks.

Thanks,
AB.

-- PNG file can be found at

http://docs.passoire.fr/alexis/perso/2-7.png

-- C code (compiled by gcc -o test test.c `pkg-config --cflags --libs gtk+-2.0`)

#define TEST_FILE "2-7.png"

#define SNIFF_BUFFER_SIZE 4096

#include<gtk/gtk.h>
#include <glib.h>
#include <gio/gio.h>

int main ( int argc, char *argv[] ) {
  gtk_init (&argc, &argv);

  GdkPixbuf *test = NULL; 
  GError *gerror=NULL ; 

  gboolean uncertain;
  gchar *mime_type;
  FILE *f;
  int size;

  guchar buffer[SNIFF_BUFFER_SIZE];

  f = g_fopen (TEST_FILE, "rb");
  size = fread (&buffer, 1, sizeof (buffer), f);
  fclose (f);
  mime_type = g_content_type_guess (NULL, buffer, size, &uncertain);

  printf("Mime: %s\n",mime_type);
  if(uncertain) printf("(uncertain)\n");
  
  test = gdk_pixbuf_new_from_file(TEST_FILE,&gerror);
  if(!test) {
    printf("test file load failure, error message: %s\n",
         gerror->message);
  } 
}

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (1001, 'testing'), (60, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/3 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libgdk-pixbuf2.0-0 depends on:
ii  libc6                    2.13-27
ii  libgdk-pixbuf2.0-common  2.26.1-1
ii  libglib2.0-0             2.32.0-4
ii  libjasper1               1.900.1-13
ii  libjpeg8                 8d-1
ii  libpng12-0               1.2.49-1
ii  libtiff4                 3.9.6-2
ii  libx11-6                 2:1.4.4-4
ii  multiarch-support        2.13-27

libgdk-pixbuf2.0-0 recommends no packages.

libgdk-pixbuf2.0-0 suggests no packages.

-- no debconf information





More information about the pkg-gnome-maintainers mailing list