lsix
lsix copied to clipboard
"unable to open image file" error on Ubuntu 20.04
Thank you for making this project.
I am on Ubuntu 20.04 platform. When I run ./lsix
in sixel
supported terminal, I get the following errors:
montage-im6.q16: unable to open image `file://contents.png': No such file or directory @ error/blob.c/OpenBlob/2874.
montage-im6.q16: unable to open image `file://test.png': No such file or directory @ error/blob.c/OpenBlob/2874.
montage-im6.q16: unable to open image `file://test.png': No such file or directory @ error/blob.c/OpenBlob/2874.
montage-im6.q16: missing an image filename `gif:-' @ error/montage.c/MontageImageCommand/1795.
convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/560.
convert-im6.q16: no images defined `sixel:-' @ error/convert.c/ConvertImageCommand/3258.
How odd. What version of ImageMagick are you running?
convert --version
Are you able to view the images using convert
?
convert test.png -geometry 800x500 sixel:-
If so, does it only break when using the file: URI?
convert file://contents.png -geometry 800x500 sixel:-
If that fails, please try it with the full work directory:
convert file://`pwd`/contents.png -geometry 800x500 sixel:-
Thank you for the bug report.
@hackerb9 Thank you for responding.
convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
No news is good news in Linux, so the following command works:
convert test.png -geometry 800x500 sixel:-
It looks like a path issue:
convert file://contents.png -geometry 800x500 sixel:-
convert-im6.q16: unable to open image `file://contents.png': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `sixel:-' @ error/convert.c/ConvertImageCommand/3258.
Feeding the full path also doesn't work:
convert file://`pwd`/contents.png -geometry 800x500 sixel:-
convert-im6.q16: unable to open image `file:///home/****/Desktop/01-2022/contents.png': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no images defined `sixel:-' @ error/convert.c/ConvertImageCommand/3258.
I think it stems from the policy files in /etc/ImageMagick-6/
as suggested here https://askubuntu.com/questions/1181762/imagemagickconvert-im6-q16-no-images-defined
I played with the settings in /etc/ImageMagick-6/policy.xml
.
I allowed path
and url
in the policy.xml
but it didn't work. I even completely removed that file but nothing's changed.
I've just built ImageMagick
from github source and it works well.
I'm glad ImageMagick works from source, but it's very weird that it doesn't work out of the box. I'd like to track that down.
I've examined Ubuntu's ImageMagick configuration files and it doesn't look like it has anything odd in the policy file. It hasn't even been updated since June of 2021.
If the problem was with the policy file, I think ImageMagick would not say "No such file or directory". Policy errors usually look like this:
montage-im6.q16: attempt to perform an operation not allowed by the security policy `FILE' @ error/constitute.c/IsCoderAuthorized/421.
Would you please humor me and try reinstalling Ubuntu's version then send me the output from these two commands?
This first one should work fine since it doesn't use file://
at all:
convert -debug all test.png -geometry 800x500 sixel:-
This second one should fail:
convert -debug all file://test.png -geometry 800x500 sixel:-
Thanks!
/usr/bin/convert -debug all test.png -geometry 800x500 sixel:-
works well again but output of its debug very long.
I post debug output of failing one:
/usr/bin/convert -debug all file://test.png -geometry 800x500 sixel:-
2022-01-06T14:10:40+03:00 0:00.000 0.000u 6.9.10 Configure convert[5457]: utility.c/ExpandFilenames/954/Configure
Command line: /usr/bin/convert {-debug} {all} {file://test.png} {-geometry} {800x500} {sixel:-}
2022-01-06T14:10:40+03:00 0:00.000 0.000u 6.9.10 Policy convert[5457]: policy.c/IsRightsAuthorized/604/Policy
Domain: Module; rights=Read; pattern="PNG" ...
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/usr/share/ImageMagick-6/coder.xml"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/coder.xml"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/etc/ImageMagick-6/coder.xml"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/usr/share/doc/imagemagick-6-common/htmlcoder.xml"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/home/****/.config/ImageMagick/coder.xml"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/home/****/.magick/coder.xml"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Configure convert[5457]: coder.c/LoadCoderCache/818/Configure
Loading coder configuration file "/etc/ImageMagick-6/coder.xml" ...
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Module convert[5457]: module.c/OpenModule/1300/Module
Searching for module "PNG" using filename "png.la"
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Module convert[5457]: module.c/GetMagickModulePath/546/Module
Searching for coder module file "png.la" ...
2022-01-06T14:10:40+03:00 0:00.010 0.000u 6.9.10 Module convert[5457]: module.c/OpenModule/1309/Module
Opening module at path "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10/modules-Q16/coders/png.la"
2022-01-06T14:10:40+03:00 0:00.010 0.010u 6.9.10 Module convert[5457]: module.c/OpenModule/1336/Module
Method "RegisterPNGImage" in module "PNG" at address 0x7ffbb4062b00
2022-01-06T14:10:40+03:00 0:00.010 0.010u 6.9.10 Module convert[5457]: module.c/OpenModule/1350/Module
Method "UnregisterPNGImage" in module "PNG" at address 0x7ffbb40630c0
2022-01-06T14:10:40+03:00 0:00.010 0.010u 6.9.10 Policy convert[5457]: policy.c/IsRightsAuthorized/604/Policy
Domain: Module; rights=Read; pattern="FiLE" ...
2022-01-06T14:10:40+03:00 0:00.010 0.010u 6.9.10 Module convert[5457]: module.c/OpenModule/1300/Module
Searching for module "FiLE" using filename "file.la"
2022-01-06T14:10:40+03:00 0:00.010 0.010u 6.9.10 Module convert[5457]: module.c/GetMagickModulePath/546/Module
Searching for coder module file "file.la" ...
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/usr/share/ImageMagick-6/delegates.xml"
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/delegates.xml"
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/etc/ImageMagick-6/delegates.xml"
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/usr/share/doc/imagemagick-6-common/htmldelegates.xml"
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/home/****/.config/ImageMagick/delegates.xml"
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/home/****/.magick/delegates.xml"
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Configure convert[5457]: delegate.c/LoadDelegateCache/2096/Configure
Loading delegate configuration file "/etc/ImageMagick-6/delegates.xml" ...
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Policy convert[5457]: policy.c/IsRightsAuthorized/604/Policy
Domain: Path; rights=Read; pattern="file://test.png" ...
2022-01-06T14:10:40+03:00 0:00.030 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/usr/share/ImageMagick-6/locale.xml"
2022-01-06T14:10:40+03:00 0:00.040 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/locale.xml"
2022-01-06T14:10:40+03:00 0:00.040 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/etc/ImageMagick-6/locale.xml"
2022-01-06T14:10:40+03:00 0:00.040 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/usr/share/doc/imagemagick-6-common/htmllocale.xml"
2022-01-06T14:10:40+03:00 0:00.040 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/home/****/.config/ImageMagick/locale.xml"
2022-01-06T14:10:40+03:00 0:00.040 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/home/****/.magick/locale.xml"
2022-01-06T14:10:40+03:00 0:00.040 0.010u 6.9.10 Configure convert[5457]: locale.c/LoadLocaleCache/1209/Configure
Loading locale configure file "/usr/share/ImageMagick-6/locale.xml" ...
2022-01-06T14:10:40+03:00 0:00.050 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/usr/share/ImageMagick-6/english.xml"
2022-01-06T14:10:40+03:00 0:00.090 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10//config-Q16/english.xml"
2022-01-06T14:10:40+03:00 0:00.090 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/etc/ImageMagick-6/english.xml"
2022-01-06T14:10:40+03:00 0:00.090 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/usr/share/doc/imagemagick-6-common/htmlenglish.xml"
2022-01-06T14:10:40+03:00 0:00.090 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/home/****/.config/ImageMagick/english.xml"
2022-01-06T14:10:40+03:00 0:00.090 0.010u 6.9.10 Locale convert[5457]: locale.c/GetLocaleOptions/856/Locale
Searching for locale file: "/home/****/.magick/english.xml"
2022-01-06T14:10:40+03:00 0:00.090 0.010u 6.9.10 Configure convert[5457]: locale.c/LoadLocaleCache/1209/Configure
Loading locale configure file "/usr/share/ImageMagick-6/english.xml" ...
2022-01-06T14:10:40+03:00 0:00.090 0.020u 6.9.10 Exception convert[5457]: blob.c/OpenBlob/2874/Exception
unable to open image `file://test.png': No such file or directory
2022-01-06T14:10:40+03:00 0:00.090 0.020u 6.9.10 Cache convert[5457]: cache.c/DestroyPixelCache/1182/Cache
destroy
2022-01-06T14:10:40+03:00 0:00.090 0.020u 6.9.10 Policy convert[5457]: policy.c/IsRightsAuthorized/604/Policy
Domain: Path; rights=Read; pattern="file://test.png" ...
2022-01-06T14:10:40+03:00 0:00.090 0.020u 6.9.10 Exception convert[5457]: blob.c/OpenBlob/2874/Exception
unable to open image `file://test.png': No such file or directory
2022-01-06T14:10:40+03:00 0:00.090 0.020u 6.9.10 Cache convert[5457]: cache.c/DestroyPixelCache/1182/Cache
destroy
2022-01-06T14:10:40+03:00 0:00.110 0.020u 6.9.10 Exception convert[5457]: convert.c/ConvertImageCommand/3258/Exception
no images defined `sixel:-'
convert: unable to open image `file://test.png': No such file or directory @ error/blob.c/OpenBlob/2874.
convert: no images defined `sixel:-' @ error/convert.c/ConvertImageComma
FYI /usr/bin/convert file://
pwd/test.png -geometry 800x500 sixel:-
also is not working.
Output of /usr/bin/convert -debug all test.png -geometry 800x500 sixel:-
:
debug-convert.txt
Same for me, /usr/bin/convert file://foo.jpg -geometry 800x500 sixel:- is not working, without the "file://" protocol it works fine.
So, if I remove the "file://" prefix in lsix, i.e. so line 243 reads like
onerow[len++]="$1"
everything is fine, I can see all image thumbnails, even when using path names in the command.
Is there any disadvantage or security implication to omit the "file://" protocol?
Otherwise I would suggest to just omit it.
Thank you. It is not a security issue. If I recall correctly, it was a workaround for the way ImageMagick treats files that have a colon in them. I can turn that into an "if/then", but am reluctant to complicate the code if the problem is actually in Ubuntu.
Just to double check: you are using Ubuntu 20? What version of ImageMagick is installed?
Oh, sorry, I seem to have hijacked this thread. No, not Ubuntu. I read this thread and figured it matched my findings. I'm on openSUSE 15.3, ImageMagick 7.0.7-34 with some default SUSE hardening.
In my policy.xml, there is
<policy domain="coder" rights="none" pattern="URL" />
without this line (or changing to rights="read|write"), "file://" works.