Bug 3546

Summary: corrupt icon file crashes openshot
Product: Fedora Reporter: dwb7
Component: openshotAssignee: Richard <hobbes1069>
Status: RESOLVED FIXED    
Severity: normal CC: dwb7, kees.dejong+dev
Priority: P5    
Version: 21   
Hardware: All   
OS: GNU/Linux   
namespace:

Description dwb7 2015-02-15 05:28:32 CET
Hi.

The package openshot-1.4.3-2.fc21.noarch would appear to include a
corrupt file:

        messagebox.py:91:show:GError: Failed to load image
        '/usr/share/icons/hicolor/48x48/apps/openshot.png': Fatal error
        in PNG image file: Read Error


The file is present:

        rpm -ql openshot |grep openshot.png |grep hicolor
        /usr/share/icons/hicolor/48x48/apps/openshot.png

and as far as the RPM is concerned, not corrupted (rpm -q --verify
openshot returns nothing).

But, the file itself is definitely corrupted:

        display /usr/share/icons/hicolor/48x48/apps/openshot.png
        display: Expected 125 bytes; found 87 bytes
        `/usr/share/icons/hicolor/48x48/apps/openshot.png' @
        warning/png.c/MagickPNGWarningHandler/1832.
        display: Read Exception
        `/usr/share/icons/hicolor/48x48/apps/openshot.png' @
        error/png.c/MagickPNGErrorHandler/1806.
        display: corrupt image
        `/usr/share/icons/hicolor/48x48/apps/openshot.png' @
        error/png.c/ReadPNGImage/4077.


Openshot would appear to attempt to load this file during several dialog
boxes and when that load fails, openshot crashes.

Thanks.
Comment 1 Richard 2015-02-16 00:13:32 CET
I can not reproduce the error. I downloaded the f21 package (I'm still on F20) and unpacked the rpm and was able to open the file in an image editor without issue.
Comment 2 dwb7 2015-02-16 03:52:33 CET
ok. I'm on F21...

Wanted to confirm the sha1sum of the file:

0efece29fe8ec543cffbe780399b3084c89c6ded /usr/share/icons/hicolor/48x48/apps/openshot.png

I'll note that xdg-open opens it... display (from ImageMagick) does not -- and was he error I pasted in.

Seems that while gimp will open it, on the commandline I do see:

gimp /usr/share/icons/hicolor/48x48/apps/openshot.png
libpng error: Read Error

So, perhaps some issue with libpng being more... I dunno... about the png standards? Or a new bug in libpng?

Is there any way to confirm the actual validity of the file conforming to png standards?
Comment 3 Richard 2015-02-16 04:11:28 CET
I don't have the same sha1sum on F20 but the icon is (ironically) created on the fly using the "convert" program from the ImageMagick package.
Comment 4 dwb7 2015-02-16 04:35:34 CET
Taking a look at the spec and running the file through pngfix... the png file is indeed corrupt.

pngfix shows:

pngfix  /usr/share/icons/hicolor/48x48/apps/openshot.png
IDAT OK  maximum 15 15 10835 18480 /usr/share/icons/hicolor/48x48/apps/openshot.png
tEXt ERR 0c read Success Success damaged_PNG_stream /usr/share/icons/hicolor/48x48/apps/openshot.png

taking a look at the end of the file at the tEXT chunk, the file shows the length of that chunk as being 7D bytes (125 decimal) -- but there are definitely NOT 125 bytes prior to the IEND. 

This seems to correlate with the error I'm geting from display/ImageMagick on fedora 21.

I'd respectfully suggest that your build system has a bug in its release of the "convert" program.

If I run the openshot.svg through convert on my fedora 21 system, I get a png that is free of errors:

convert /usr/share/icons/hicolor/scalable/apps/openshot.svg -resize 48x48 /tmp/file.png

Thanks.

ps pngfix came from download and compiling a new copy of libpng-1.6.16 .
Comment 5 Richard 2015-02-16 15:41:19 CET
Unless there's a desktop environment in Fedora that's not capable of using scalable images, I may just drop the icon altogether....
Comment 6 dwb7 2015-02-16 15:47:01 CET
Dunno... will OpenShot work at all if that png isn't there (it certainly won't work if the png is corrupt, as previously discussed)... what command, exactly, did you use to create the png?
Comment 7 Richard 2015-02-16 15:52:40 CET
(In reply to comment #6)
> Dunno... will OpenShot work at all if that png isn't there (it certainly won't
> work if the png is corrupt, as previously discussed)... what command, exactly,
> did you use to create the png?

The png doesn't come from OpenShot, it only provides a SVG which I use the convert command to create a 48x48 PNG. It was an attempt to comply with the packaging guidelines at the time which seemed to indicate at a minimum that a 48x48 icon was required.

It's not actually in the Fedora packaging guidelines but in the desktop file specs:

http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#install_icons

which we adhere to.

Maybe I should just try a simple rebuild...
Comment 8 dwb7 2015-02-16 16:57:01 CET
Right. I meant what was the cmdline used for "convert" to get from the svg to the png? 

If you want to try a rebuild and put the rebuilt rpm someplace, I can grab it, extract the files and see if the png is still corrupt.
Comment 9 Richard 2015-02-16 17:38:14 CET
The command is:
convert -resize 48x48 -strip \
        %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg \
        %{name}.png

The -strip option is supposed to remove all comments but it seems to fail on odd number Fedora releases :) I can build fine on F20 but on F21 it needs an extra:

# Take more drastic action because -strip doesn't seem to work in F15
sed -i 's|%{buildroot}||g' %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png

Which as you can see I added for F15... The problem is that convert writes some comments based on the file location and an automatic script that runs looks in all files for the existence of "%{buildroot}" and errors out if it finds it. It doesn't hurt in this particular case but it's not smart enough to know that. 

I'm guessing its the brute force sed command above that's causing the issue, but the build will fail without it.
Comment 10 Richard 2015-04-06 21:22:11 CEST
*** Bug 3583 has been marked as a duplicate of this bug. ***
Comment 11 Richard 2015-04-06 21:23:37 CEST
Ok, $FAMILY and $DAYJOB have been sucking up all my spare cycles lately but I'm going to try to get this closed out soon. I would prefer a more elegant solution but I think instead of converting icons on the fly I'll just make one in GIMP and be done with it as 2.0 may have new icons anyway.
Comment 12 Richard 2015-04-07 15:29:19 CEST
Builds for devel/f21 and f20 are complete.