After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 421175 - Crash when thumbnailing Canon raw image using libopenraw
Crash when thumbnailing Canon raw image using libopenraw
Status: RESOLVED FIXED
Product: gthumb
Classification: Other
Component: general
2.10.x
Other FreeBSD
: Normal normal
: ---
Assigned To: Paolo Bacchilega
Paolo Bacchilega
Depends on:
Blocks:
 
 
Reported: 2007-03-21 19:17 UTC by Pav Lucistnik
Modified: 2008-02-28 14:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libopenraw-generated thumbnail of DSC_0489.png (16.79 KB, image/png)
2007-03-22 12:30 UTC, Michael Chudobiak
Details
thumbnails with libopenraw 0.0.4 (42.71 KB, image/png)
2008-02-22 15:47 UTC, Pav Lucistnik
Details
the thumbnail from IMG_8013.CR2 (4.77 KB, image/jpeg)
2008-02-22 16:29 UTC, Hubert Figuiere (:hub)
Details

Description Pav Lucistnik 2007-03-21 19:17:34 UTC
gThumb 2.10.0, built with libopenraw support (libopenraw-0.0.2 used) crashes after entering a directory with this file

http://www.safo.cz/foto/IMG_9410.CR2

Here is a backtrace. BTW interesting is that nautilus reports the file as 'TIFF', which is not true, either.

I'll happily provide any feedback.

(gdb) bt
  • #0 scale_line
    at pixops.c line 827
  • #1 pixops_process
    at pixops.c line 1146
  • #2 _pixops_scale
    at pixops.c line 1623
  • #3 IA__gdk_pixbuf_scale
    at gdk-pixbuf-scale.c line 77
  • #4 IA__gdk_pixbuf_scale_simple
    at gdk-pixbuf-scale.c line 256
  • #5 thumb_loader_done_cb
    at thumb-loader.c line 581
  • #6 g_closure_invoke
    from /usr/local/lib/libgobject-2.0.so.0
  • #7 g_signal_has_handler_pending
    from /usr/local/lib/libgobject-2.0.so.0
  • #8 g_signal_emit_valist
    from /usr/local/lib/libgobject-2.0.so.0
  • #9 g_signal_emit
    from /usr/local/lib/libgobject-2.0.so.0
  • #10 image_loader_stop__final_step
    at image-loader.c line 712
  • #11 image_loader_stop_common
    at image-loader.c line 886
  • #12 image_loader_done
    at image-loader.c line 588
  • #13 check_thread
    at image-loader.c line 743
  • #14 g_main_context_is_owner
    from /usr/local/lib/libglib-2.0.so.0
  • #15 g_main_context_dispatch
    from /usr/local/lib/libglib-2.0.so.0
  • #16 g_main_context_acquire
    from /usr/local/lib/libglib-2.0.so.0
  • #17 g_main_loop_run
    from /usr/local/lib/libglib-2.0.so.0
  • #18 IA__gtk_main
    at gtkmain.c line 1154
  • #19 main
    at main.c line 832

Comment 1 Michael Chudobiak 2007-03-21 19:52:13 UTC
I can't reproduce the crash. 

Does it happen reliably? What if you move it to another directory?

In Edit > Preferences > Browser, is the "Determine Image Type from Content" selected or unselected? Does it make a difference if you change that?

Do you have dcraw installed?

The incorrect mime type is worrisome, though. We may have to override gnome's mime type detection for CR2 files (we do that for NEF files already).

Anyway... if you have any additional clues, they would be useful...

- Mike
Comment 2 Pav Lucistnik 2007-03-21 19:57:39 UTC
Happens every time. After it happens, I need to delete thumbnails cache to make it happen again (rm -rf ~/.thumbnails).

The "Determine Image Type" checkbox is unchecked. When I check it, it no longer crashes. But it does not display any thumbnail either.

I don't have dcraw installed.

You get the thumbnail?
Comment 3 Michael Chudobiak 2007-03-21 20:10:17 UTC
Yes, I get a thumbnail.

Do you know how to compile from svn? I added a patch to svn trunk to override the gnome mimetype detection, so CR2 files will not be recognized as TIFF files.

I don't see much in your backtrace. Can you try "bt full" and "thread apply all bt" and see if it generates something more suggestive of a crash?

- Mike
Comment 4 Pav Lucistnik 2007-03-21 21:07:36 UTC
The change from svn made only difference in that now it tried to thumbnail the CR2 file regardless of the preference toggle "Determine Image Type".

I also slurped a NEF file from the internet (http://www.steves-digicams.com/nikond1/samples/DSC_0489.nef) and it crashes on it, too. After restart, it reads corrupted thumb from ~/.thumbnails. Opening that NEF file then gives me correct image, but only 160x120 in size.
Comment 5 Pav Lucistnik 2007-03-21 21:21:40 UTC
bt full backtrace available at http://raven.oook.cz/gthumb.txt
Comment 6 Michael Chudobiak 2007-03-22 12:30:58 UTC
Created attachment 85105 [details]
libopenraw-generated thumbnail of DSC_0489.png

Here is the thumbnail of DSC_0489.png generated on my system. Note the odd garbage at the top of the image. Maybe libopenraw is generating corrupt pngs or something. I will ask Hubert Figuière, the author of libopenraw, to comment.

- Mike
Comment 7 Hubert Figuiere (:hub) 2007-03-22 15:40:58 UTC
I think it is more about Gnome/gthumb picking up that file as being TIFF and libtiff choking on it. I have seen that happening.
The version of Gnome I currently have does not exhibit the problem.
Comment 8 Michael Chudobiak 2007-03-22 15:49:36 UTC
Hubert,

the svn versions of gthumb override the gnome mimetype identification for CR2 files. (The release and svn versions do this for NEF too). I don't think it is a libtiff issue.

What do you think of the thumbnail in comment 6? Do you see similar "noise" at the top of the image when you generate a thumbnail from http://www.steves-digicams.com/nikond1/samples/DSC_0489.nef?

- Mike
Comment 9 Michael Chudobiak 2007-03-22 15:51:14 UTC
Pav,

Can you temporarily remove libopenraw, and install dcraw? (And delete your thumbnail cache too.) If libopenraw is not present, gthumb will use dcraw to generate thumbnails.

- Mike
Comment 10 Pav Lucistnik 2007-03-22 16:07:14 UTC
With gthumb built without libopenraw and no dcraw, I get letterboxes thumbnail on NEF file, and nothing on CR2 file.

With dcraw added, I get good thumbnails on both NEF and CR2 files. I can also open the pictures just fine. Only drawback of dcraw seems to be ~15 second processing time on the CR2 file.
Comment 11 Hubert Figuiere (:hub) 2007-03-22 17:22:55 UTC
> What do you think of the thumbnail in comment 6? Do you see similar "noise" at
> the top of the image when you generate a thumbnail from
> http://www.steves-digicams.com/nikond1/samples/DSC_0489.nef?


the D1 is not in the list of supported cameras YET. Because I didn't have a sample.

I'll check that.
Comment 12 Hubert Figuiere (:hub) 2007-03-22 17:32:01 UTC
(In reply to comment #11)
> > http://www.steves-digicams.com/nikond1/samples/DSC_0489.nef?
> 
> the D1 is not in the list of supported cameras YET. Because I didn't have a
> sample.
> 
> I'll check that.

Works for me with the "demo" program from libopenraw. Make it is libopenraw that is called and not libtiff.
Comment 13 Pav Lucistnik 2007-03-22 17:36:03 UTC
The demo/thumbc from libopenraw dist gets me a correct thumbnail, when invoked on the CR2 file manually.
Comment 14 Pav Lucistnik 2007-03-22 17:41:11 UTC
BTW it spits this on console

** (gthumb:98633): DEBUG: file /usr/home/pav/_/IMG_9410.CR2 is raw

I checked and this comes from libopenraw, so it's obvious it's called.
Comment 15 Michael Chudobiak 2007-03-22 17:47:34 UTC
The demo/thumbc program doesn't seem to work on the http://www.steves-digicams.com/nikond1/samples/DSC_0489.nef file for me.

It creates a jpg file, but gthumb can't read it (nor can any other viewer).

- Mike
Comment 16 Michael Chudobiak 2007-03-22 17:49:29 UTC
Pav, what version of gtk2 do you have installed? (I have 2.10.8).

- Mike
Comment 17 Pav Lucistnik 2007-03-22 18:18:45 UTC
gtk-2.10.11, and the GNOME platform is at 2.18.0
Comment 18 Pav Lucistnik 2007-03-22 18:44:04 UTC
Downgrading to 2.10.8 changed nothing for me.
Comment 19 Hubert Figuiere (:hub) 2007-03-22 20:11:47 UTC
(In reply to comment #15)
> The demo/thumbc program doesn't seem to work on the
> http://www.steves-digicams.com/nikond1/samples/DSC_0489.nef file for me.
> 
> It creates a jpg file, but gthumb can't read it (nor can any other viewer).

It does not generate a JPG file. Just a file that has a .jpg extension (because I was lazy when I wrote these). The file is actually a 160x120 RGB8 pixmap. Use rawtoppm to convert it to a ppm file.
Comment 20 Michael Chudobiak 2007-03-22 20:38:34 UTC
Oh, thanks. The demo program does create a good thumbnail.

There is something flaky in the gthumb/libopenraw interaction though. Sometimes I get corruption in NEF thumbnails, sometimes I don't. (A corrupted thumbnail is shown in comment 6). I've seen this in at least two NEF files. But right now, I can't reproduce it!

Maybe there is some sort of race condition in "or_gdkpixbuf_extract_thumbnail"...

- Mike
Comment 21 Hubert Figuiere (:hub) 2008-02-12 19:05:56 UTC
does the problem still occur with libopenraw 0.0.4?
Comment 22 Pav Lucistnik 2008-02-22 15:47:49 UTC
Created attachment 105765 [details]
thumbnails with libopenraw 0.0.4
Comment 23 Pav Lucistnik 2008-02-22 15:48:28 UTC
It no longer crashes with libopenraw 0.0.4.

But the thumbnail have wrong colors, see attachment.
Comment 24 Hubert Figuiere (:hub) 2008-02-22 15:54:06 UTC
without the original file, hard to tell. but I can assure you that the thumbnail data is just *extracted* from the file. no processing applied.
Comment 25 Pav Lucistnik 2008-02-22 16:09:45 UTC
Different raw file is available for download in the original bug report - it too exhibits wrong color in thumbnail. The airplane shot from the sample I just attached is temporarily for download from http://hood.oook.cz/letadla/
Comment 26 Hubert Figuiere (:hub) 2008-02-22 16:29:02 UTC
Created attachment 105770 [details]
the thumbnail from IMG_8013.CR2

Attached is the thumbnail I extracted. You'll notice that there is not problem unlike on the screenshot. Are you sure it is using libopenraw?
Comment 27 Pav Lucistnik 2008-02-22 21:05:14 UTC
./configure said

        Have libopenraw:          yes

so I suppose it's using libopenraw, and I don't have dcraw installed. But you're right, yours look like embedded thumbnails, with those characteristic black bands.

When I run demo/thumb thingie from the libopenraw's tarball on these files, I get correct files, too. So it must be something in interaction between libopenraw and gthumb.
Comment 28 Hubert Figuiere (:hub) 2008-02-22 21:19:32 UTC
AFAI, gthumb use the available thumbnail if it exists.
Comment 29 Pav Lucistnik 2008-02-22 21:44:17 UTC
I have added some debugging printf calls to the gthumb source, and I can confirm that or_gdkpixbuf_extract_thumbnail() is actually getting called, and that it returns non-NULL pixbuf.

There seems to be a problem with the second argument to that function call. When I give it a zero, it returns correct thumbnail. When I give it 120, which happens to be a size of the embedded thumbnail, it returns correct thumbnail. But when I give it 164, it returns a green blob.
Comment 30 Pav Lucistnik 2008-02-22 21:49:47 UTC
Correction: anything below and up to 160, which is a size of embedded thumbnail.
Comment 31 Hubert Figuiere (:hub) 2008-02-22 22:09:46 UTC
The size is actually 160 in that specific case.

Apparently the bug is that the higher resolution preview has a strange color cast. I don't know exactly why.
However this revealed another bug I forgot about as the bigger resolution is not recognized as JPEG.
Comment 32 Hubert Figuiere (:hub) 2008-02-26 00:31:09 UTC
The intermediate size thumbnail is now recognized in the right format, ie 8RGB. Code in git.

I think that this bug should be closed. I'll release 0.0.5 very soon now.
Comment 33 Pav Lucistnik 2008-02-26 10:34:58 UTC
I have upgraded to libopenraw-0.0.5, but the thumbnails are still green.
Comment 34 Michael Chudobiak 2008-02-26 12:52:07 UTC
Just checking... did you remember to rm -rf ~/.thumbnails?

- Mike
Comment 35 Pav Lucistnik 2008-02-26 12:54:57 UTC
Yes, I did rm -rf ~/.thumbnails, even renamed the raw file to be absolutly sure.
Comment 36 Hubert Figuiere (:hub) 2008-02-26 15:03:11 UTC
I never said the green was fixed nor that it would be. This is because that's the way the data is in the file.

This bug is about a crash due to wrong format being used or provided. I think I have ironed out most of the issues now.
Comment 37 Pav Lucistnik 2008-02-26 15:05:43 UTC
As for the crash alone, yes, that seems to be fixed now. Thank you!