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 759273 - [PATCH] Improve TIFF ops error handling
[PATCH] Improve TIFF ops error handling
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: operations
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2015-12-09 21:00 UTC by Martin Blanchard
Modified: 2016-02-23 21:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] Improve error handling (3.48 KB, patch)
2015-12-09 21:00 UTC, Martin Blanchard
none Details | Review
Second version, avoid printing empty strings... (3.65 KB, patch)
2015-12-21 22:16 UTC, Martin Blanchard
none Details | Review
Add missing include (1.11 KB, patch)
2016-01-14 21:42 UTC, Martin Blanchard
none Details | Review
Fix switch case and return (1.17 KB, patch)
2016-01-14 21:43 UTC, Martin Blanchard
none Details | Review

Description Martin Blanchard 2015-12-09 21:00:09 UTC
Created attachment 317078 [details] [review]
[PATCH] Improve error handling

[PATCH] tiff: Improve error handling for loader and saver

Do not let libtiff write to stdout and correct the on-error cleanup code (double free / unref).
Comment 1 Martin Blanchard 2015-12-21 22:16:12 UTC
Created attachment 317760 [details] [review]
Second version, avoid printing empty strings...
Comment 2 Øyvind Kolås (pippin) 2016-01-09 23:52:55 UTC
commit 54865cb38471971217fedfc8232dfc482a0c03c7
Author: Martin Blanchard <tchaik@gmx.com>
Date:   Mon Dec 21 23:12:08 2015 +0100

    tiff: Improve error handling for loader and saver
    
    Do not let libtiff write to stdout and correct the on-error cleanup
    code (double free / unref).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759273
Comment 3 Massimo 2016-01-14 11:12:10 UTC
(In reply to Øyvind Kolås from comment #2)
> commit 54865cb38471971217fedfc8232dfc482a0c03c7
> Author: Martin Blanchard <tchaik@gmx.com>
> Date:   Mon Dec 21 23:12:08 2015 +0100
> 
>     tiff: Improve error handling for loader and saver
>     
>     Do not let libtiff write to stdout and correct the on-error cleanup
>     code (double free / unref).
>     
>     https://bugzilla.gnome.org/show_bug.cgi?id=759273

This commit introduced new warnings. It seems
that 'g_vasprintf' is not declared unless <glib/gprintf.h>
is included. GLib doumentation on this particular function
is probably not yet updated, but Gcc warns.

BTW opening tiff-load.c I noticed that the function
'lseek_to_seek_type' is inconsistent (vim syntax highlighting
looks weird) I'd say the SEEK_END case is inverted:

https://git.gnome.org/browse/gegl/tree/operations/external/tiff-load.c#n99

and it seems this 'switch' has been copy/pasted in
'seek_in_stream' and also in tiff-save.c
Comment 4 Massimo 2016-01-14 11:28:13 UTC
(In reply to Massimo from comment #3)
> (In reply to Øyvind Kolås from comment #2)
> > commit 54865cb38471971217fedfc8232dfc482a0c03c7
> > Author: Martin Blanchard <tchaik@gmx.com>
> > Date:   Mon Dec 21 23:12:08 2015 +0100
> > 
> >     tiff: Improve error handling for loader and saver
> >     
> >     Do not let libtiff write to stdout and correct the on-error cleanup
> >     code (double free / unref).
> >     
> >     https://bugzilla.gnome.org/show_bug.cgi?id=759273
> 
> This commit introduced new warnings. It seems
> that 'g_vasprintf' is not declared unless <glib/gprintf.h>
> is included. GLib doumentation on this particular function
> is probably not yet updated, but Gcc warns.
> 

https://build.gimp.org/job/gegl-master/879/parsed_console/job/gegl-master/879/parsed_console/log_content.html#WARNING297

https://build.gimp.org/job/gegl-master/879/parsed_console/job/gegl-master/879/parsed_console/log_content.html#WARNING298
Comment 5 Martin Blanchard 2016-01-14 21:41:51 UTC
(In reply to Massimo from comment #3)
> This commit introduced new warnings. It seems
> that 'g_vasprintf' is not declared unless <glib/gprintf.h>
> is included. GLib doumentation on this particular function
> is probably not yet updated, but Gcc warns.

GLib documentation is actually pretty clear about this, my bad...

> BTW opening tiff-load.c I noticed that the function
> 'lseek_to_seek_type' is inconsistent (vim syntax highlighting
> looks weird) I'd say the SEEK_END case is inverted:
> 
> https://git.gnome.org/browse/gegl/tree/operations/external/tiff-load.c#n99
> 
> and it seems this 'switch' has been copy/pasted in
> 'seek_in_stream' and also in tiff-save.c

This is obviously another stupid error... Hopefully, libtiff always seek using SEEK_CUR, as far as I could notice.
Comment 6 Martin Blanchard 2016-01-14 21:42:46 UTC
Created attachment 319054 [details] [review]
Add missing include
Comment 7 Martin Blanchard 2016-01-14 21:43:58 UTC
Created attachment 319055 [details] [review]
Fix switch case and return
Comment 8 Øyvind Kolås (pippin) 2016-01-14 21:46:56 UTC
commit e7e926115f16080a952d578901124e59d23cb2e3
Author: Martin Blanchard <tchaik@gmx.com>
Date:   Thu Jan 14 22:13:43 2016 +0100

    tiff: Fix includes for g_vasprintf and keep gcc quiet
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759273
Comment 9 Massimo 2016-01-16 11:18:47 UTC
(In reply to Martin Blanchard from comment #5)
> (In reply to Massimo from comment #3)
> > This commit introduced new warnings. It seems
> > that 'g_vasprintf' is not declared unless <glib/gprintf.h>
> > is included. GLib doumentation on this particular function
> > is probably not yet updated, but Gcc warns.
> 
> GLib documentation is actually pretty clear about this, my bad...
> 

Well, under Description it says:

<quote>
Note that the functions g_printf(), g_fprintf(), g_sprintf(), g_snprintf(), g_vprintf(), g_vfprintf(), g_vsprintf() and g_vsnprintf() are declared in the header gprintf.h which is not included in glib.h (otherwise using glib.h would drag in stdio.h), so you'll have to explicitly include <glib/gprintf.h> in order to use the GLib printf() functions.
</quote>

It doesn't mention g_vasprintf

> > BTW opening tiff-load.c I noticed that the function
> > 'lseek_to_seek_type' is inconsistent (vim syntax highlighting
> > looks weird) I'd say the SEEK_END case is inverted:
> > 
> > https://git.gnome.org/browse/gegl/tree/operations/external/tiff-load.c#n99
> > 
> > and it seems this 'switch' has been copy/pasted in
> > 'seek_in_stream' and also in tiff-save.c
> 
> This is obviously another stupid error... Hopefully, libtiff always seek
> using SEEK_CUR, as far as I could notice.

Well, I was thinking to a compilation failure: that is G_SEEK_END
is an enum whose value is independent of SEEK_END, so it is possible
that a libc declares SEEK_CUR or SEEK_SET to that value, in that case
you'd have a switch with different case's for the same values
Comment 10 Martin Blanchard 2016-01-16 15:34:22 UTC
Opened a bug for the GLib documentation omission:

https://bugzilla.gnome.org/show_bug.cgi?id=760716
Comment 11 Martin Blanchard 2016-02-23 21:41:25 UTC
(In reply to Martin Blanchard from comment #7)
> Created attachment 319055 [details] [review] [review]
> Fix switch case and return

Anything wrong with the second patch or it has just been forgot?
Comment 12 Øyvind Kolås (pippin) 2016-02-23 21:55:24 UTC
missed it when applying pending patches, pushed now.