Page 1 of 1

Warning turned into an error

Posted: 2014-10-19T01:46:20-07:00
by broucaries
Dear Maintainer,

Recently my package lazarus FTBFS (see bug 761536). The problem is apparently
a png file that we convert during build. As you can see from the loggings of
the past builds we have seen the warning below for ages, but suddenly the warning
turned into an error (while the message still says "warning"). I am wondering if
that was intended. (If yes, I couldn'd find what the problem is with the file,
an advice on improving the figure is also appreciated).

(pbuild1845) wollumbin lazarus-1.2.4+dfsg # identify images/ide_icon48x48.png || echo we got an error
images/ide_icon48x48.png PNG 48x48 48x48+0+0 8-bit sRGB 4.24KB 0.010u 0:00.019
identify: tRNS chunk not allowed with alpha channel `images/ide_icon48x48.png' @ warning/png.c/MagickPNGWarningHandler/1831.
we got an error

Re: Warning turned into an error

Posted: 2014-10-19T07:49:41-07:00
by glennrp
In libpng-1.6.0 and later, the "tRNS not allowed with alpha channel" became a "benign error" instead of a warning, and the message
was change to "tRNS: invalid with alpha channel". But ImageMagick coders/png.c has a call "png_set_benign_errors(ping,1)" which
is supposed to cause libpng to treat them as warnings. What are your versions of ImageMagick and libpng? Because of the format
of the warning, I think you are using libpng 1.5 or earlier, which just calls png_warning() for this situation.

I don't know why "identify" and "convert" return a non-zero when there is a PNG warning. This is also happening for me when I use
an up-to-date libpng16. The warning handler seems to be setting exception properly (CoderWarning):

Code: Select all

 (void) ThrowMagickException(&image->exception,GetMagickModule(),CoderWarning, message,"`%s'",image->filename);
at line 1831 in coders/png.c. I'm just guessing that the bug is in the exception handler and not in the PNG codec.

You can use "pngcrush in.png out.png" to fix the png file (pngcrush issues a warning and removes the tRNS chunk)

The bug appears to have been introduced in ImageMagick-6.8.9-2 (-1 behaves properly).

This diff between IM-6.8.9-1 and IM-6.8.9-2 looks suspicious:

Code: Select all

glenn.rp> diff [12]/u*/identify.c
87c87
<   return(status == MagickFalse ? 0 : 1);
---
>   return(status != MagickFalse ? 0 : 1);
112c112
<   return(status == MagickFalse ? 0 : 1);
---
>   return(status != MagickFalse ? 0 : 1);

Re: Warning turned into an error

Posted: 2014-10-19T15:33:57-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-9 Beta, available by sometime tomorrow. Thanks.