Open ballapete opened 1 day ago
'test.tif' is created by the "convert" utility (associated with ImageMagick) at line 160 of t/tiff.t. See lines 103-129 for determining the presence of a usable 'convert'. Do you have 'convert" available and if so, what version is it? Maybe you have an odd combination of versions (or utility names) that pass the tests but don't work in the expected way. Are you able to manually run the appropriate code in tiff.t to see what '$convert' is, and how it behaves in test # 9?
Am 04.12.2024 um 03:36 schrieb Phil Perry @.***>:
'test.tif' is created by the "convert" utility (associated with ImageMagick) at line 160 of t/tiff.t. See lines 103-129 for determining the presence of a usable 'convert'. Do you have 'convert" available and if so, what version is it?
On that old Mac it is old, too:
Version: ImageMagick 6.9.13-16 Q16-HDRI powerpc 18467 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc heic jbig jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps raw rsvg tiff webp x xml zlib
I am user of the MacPorts package manager and therefore dependent of what its maintainers offer. PerlMagick, in a version that corresponds with ImageMagick 6.9.13-16, is not installed because it cannot be built yet on Mac OS X 10.4.11.
Are you able to manually run the appropriate code in tiff.t to see what '$convert' is, and how it behaves in test # 9?
This test seems to be
system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" $tiff_f");
or, in my (MacPorts') build environment
convert -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:\"A caption for the image\" /opt/local/var/macports/build/_Volumes_Halde_ports_perll_p5-pdf-builder/p5.34-pdf-builder/work/PDF-Builder-3.026/t/resources/test.tif
I do not use convert often, and then mostly to convert a graphics file from one format to another. In your test case it seems to insert a caption into the image – which does not exist yet…
This seems to be the meaning of the error message… (IMO) But it creates a new TIFF image! On a black background the text »"A« (without the Swiss guillemots) is visible. And in the Terminal window I got:
convert: unable to open image `caption': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/581.
convert: unable to open image `for': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: unable to open image `for': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/581.
convert: unable to open image `the': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: unable to open image `the': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/581.
convert: unable to open image `image"': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: unable to open image `image"': No such file or directory @ error/blob.c/OpenBlob/2967.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/581.
Exit 1
The problem seems to be »\"«. You are using this construct because Perl's system() expects some text string. On the command line, when I copy the backslashes convert does not see a delimited text string. On my old test system some failure seems to happen because no output at all seems to have been created.
What works on the command line is this:
convert -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:'A caption for the image' test.tif
Right now MacPorts is building and installing ≈800 Perl Modules for testing, which will take a day or such. So I tried the change (\" -> ') manually. TIFF test #9 took some time – and I got:
t/tiff.t .................... ok
t/version.t ................. ok
t/viewer-preferences.t ...... ok
All tests successful.
Test Summary Report
-------------------
t/00-all-usable.t (Wstat: 0 Tests: 110 Failed: 0)
TODO passed: 108-110
Files=44, Tests=794, 197 wallclock secs ( 0.94 usr 0.58 sys + 72.28 cusr 10.52 csys = 84.32 CPU)
Result: PASS
A solution for the old Mac is found! (And can be applied via a patch, MacPorts allows this for specific systems or OS versions.) On an almost up-to-date Mac (with macOS High Sierra, version 10.13.6 or darwin 17.7.0) the tests work with \" – and also with simple '!
I'll possibly be able to test this also on a modern intel-based Mac with macOS Sonoma before Christmas. The question is whether MS Windows versions work with this change. On other UNIX (or Linux) systems this will certainly work…
-- Mit friedvollen Grüßen
Pete
Don't just do something, sit there.
If you're attempting to run 'convert' on the command line, did you change caption:\"A caption for the image\"
to caption: "A caption for the image"
? If it didn't work, does caption:'A caption for the image'
work? If you have a string wrapped in quotation marks "
, any quotation marks within that string must be escaped \"
for a proper string to be handed off to the OS $system()
call. If it works OK to change the "
to '
(single quotes), that sounds like an error in the Mac implementation of Perl! That, or your (MacOS) command line doesn't like strings wrapped in "
but does accept strings wrapped in '
. Since such a change shouldn't harm other OS's, I could put it in t/tiff.t if that's what it takes to work with Mac. All other t-tests work? I will have to look for other embedded "
's in system()
calls in t-tests and examples, but I see at least 7 such cases in t/tiff.t alone -- did you change all of them?
I tried converting all 7 t/tiff.t system("$convert...
calls to caption:'A caption for the image'
and it didn't work in Windows! Quotation marks "
work fine on the command line and in t/tiff.t. Apparently the problem is that convert
(magick convert
in Windows) doesn't accept '
-delimited command line strings, but does accept "
. In the case of single quotes '
, it sees caption:A and then command-line entries 'caption', 'for', 'the', 'image', which it can't handle.
I see in the CPAN Testers Matrix that Darwin (a flavor of MacOS) has been successfully tested with PDF::Builder 3.026, so I'm reluctant to change the t/tiff.t code from \"
to '
until I better understand what's going on. If it's just this version of MacOS, we may just have to live with it failing at this level. If Darwin and other Mac OS's work with single quotes, I could test for OS=macos and use a single-quoted format. What do you think?
Am 04.12.2024 um 16:48 schrieb Phil Perry @.***>:
If you're attempting to run 'convert' on the command line, did you change caption:\"A caption for the image\" to caption: "A caption for the image"?
My first try as a novice to this was with backslashes, so convert misinterpreted them.
My second try, now almost practitioner, was with clean double quotes, and it worked:
tiger pete 239 /\ convert -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:"A caption for the image" test.tif
tiger pete 240 /\ rm test.tif
If it didn't work, does caption:'A caption for the image' work?
Yes, this worked as well:
tiger pete 243 /\ convert -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:'A caption for the image' test.tif
tiger pete 244 /\ rm test.tif
If you have a string wrapped in quotation marks ", any quotation marks within that string must be escaped \" for a proper string to be handed off to the OS $system() call. If it works OK to change the " to ' (single quotes), that sounds like an error in the Mac implementation of Perl!
I wouldn't say so… The single quotes are inside the outer double quotes that limit the whole command to be executed on the system. This allows Perl to substitute variables between the two double quotes with their values, text between single quotes might stay unchanged/uninterpreted. It's then left to the (operating) system how it will treat the single quotes passed to it.
That, or your (MacOS) command line doesn't like strings wrapped in " but does accept strings wrapped in '.
Phil, I rather think that Perl 5.34 does some harm here to the text string between the two outer double quotes.
Obviously on Mac OS X 10.4.11, "Tiger", the Perl statement
system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" $tiff_f");
becomes something that is not correctly understood, while
system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:'A caption for the image' $tiff_f");
is working. On the other more up-to-date Mac both versions work.
Since such a change shouldn't harm other OS's, I could put it in t/tiff.t if that's what it takes to work with Mac. All other t-tests work?
Yes, all other tests succeed, on both Macs.
I will have to look for other embedded "'s in system() calls in t-tests and examples, but I see at least 7 such cases in t/tiff.t alone -- did you change all of them?
No, only test #9:
==> t/tiff.t:159:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:'A caption for the image' $tiff_f"); <== t/tiff.t:187:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -compress Group4 $tiff_f"); t/tiff.t:215:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -compress lzw $tiff_f"); t/tiff.t:240:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -define tiff:rows-per-strip=50 -compress lzw $tiff_f"); t/tiff.t:295:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -compress lzw $tiff_f"); t/tiff.t:320:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -compress lzw $tiff_f"); t/tiff.t:372:system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption for the image\" -background white -alpha off -define tiff:rows-per-strip=50 -compress lzw $tiff_f");
Can it be that some tests were not performed? On my second, working, Mac I can try to change the names of TIFF files to start with the line number, à la "... Group4 187_$tiff_f". But the files' contents seems to get re-used – can Perl issue a comment like "Performing system() command from line #..."? (My old "Tiger" is testing once more the modules in series, one or two days to wait. With ' instead of \" on line #159.)
I have a third and up-to-date intel-based Mac for testing, some time later, after the other two have finished. And I also want to test with Perl 5.38 on all three (actually the idea is to prove with testing ≈800 Perl Modules that Perl 5.38 is ripe for regular use in MacPorts package manager). If you can wait until next year (and a not so new "president")? I would also like to discuss the issue with the MacPorts folks. PDF-Builder is supported by MacPorts.
-- Greetings
Pete
To most people solutions mean finding the answers. But to chemists solutions are things that are still all mixed up.
Am 04.12.2024 um 17:20 schrieb Phil Perry @.***>:
What do you think?
I'd wait for the results of my tests with at least two different Perl versions and particularly the comments of the MacPorts folks (package maintainers). Could be the problem is specific for Tiger, and the other Mac OS X on my old PowerBook, Mac OS X 10.5.8 or Leopard, does not have it (booting it some time next week?). MacPorts allows to patch source code for particular systems (which is performed quite often and might be easier to implement than in Perl.)
-- Greetings
Pete
"Free markets would be a great idea, if markets were actually free."
Am 04.12.2024 um 19:17 schrieb Peter Dyballa @.***>:
Can it be that some tests were not performed? On my second, working, Mac I can try to change the names of TIFF files to start with the line number, à la "... Group4 187_$tiff_f". But the files' contents seems to get re-used – can Perl issue a comment like "Performing system() command from line #..."? (My old "Tiger" is testing once more the modules in series, one or two days to wait. With ' instead of \" on line #159.)
I have an improved idea: I'll rename ImageMagick's convert to convert.orig and put a shell script in its places that echos all its arguments into a file with a time stamp! (This way I'll also find out whether MacPorts uses a chroot environment to build and test software.) Plus your test script tells, with an own time stamp, what it will perform or is performing in the background.
Could this bring us closer to what's happening?
-- Greetings
Pete
S'il n'y a pas de solutions, il n'y a pas de problèmes
My script:
#
# if [ ! -e /tmp/ ]; then mkdir /tmp fi Speicher=/tmp/Convert-Argumente Datum="$(date "+%F %T")" printf "%s – These %2d args: %s\n" "$Datum" $# "$*" >> $Speicher convert.orig "$@"
Its output in /tmp (no chroot), edited to shorten enormous paths:
2024-12-04 21:11:40 – These 1 args: -version 2024-12-04 21:11:41 – These 10 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:42 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -colorspace gray -depth 1 txt:- 2024-12-04 21:11:42 – These 4 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 txt:- 2024-12-04 21:11:42 – These 16 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image -background white -alpha off -compress Group4 …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:43 – These 4 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 1 txt:- 2024-12-04 21:11:43 – These 4 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 txt:- 2024-12-04 21:11:44 – These 16 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image -background white -alpha off -compress lzw …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:44 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 1 -alpha off txt:- 2024-12-04 21:11:44 – These 6 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 -alpha off txt:- 2024-12-04 21:11:45 – These 18 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image -background white -alpha off -define tiff:rows-per-strip=50 -compress lzw …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:45 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 1 -alpha off txt:- 2024-12-04 21:11:46 – These 6 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 -alpha off txt:- 2024-12-04 21:11:46 – These 14 args: -depth 8 -size 2x2 pattern:gray50 -scale 1000% -alpha off -define tiff:predictor=2 -compress lzw …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:46 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 8 -alpha off txt:- 2024-12-04 21:11:46 – These 6 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 8 -alpha off txt:- 2024-12-04 21:11:46 – These 12 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image -compress lzw …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:47 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -colorspace gray -depth 1 txt:- 2024-12-04 21:11:47 – These 4 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 txt:- 2024-12-04 21:11:48 – These 16 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image -background white -alpha off -compress lzw …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:48 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 1 -alpha off txt:- 2024-12-04 21:11:49 – These 6 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 -alpha off txt:- 2024-12-04 21:11:49 – These 14 args: -depth 8 -size 2x2 pattern:gray50 -scale 1000% -alpha off -define tiff:predictor=2 -compress lzw …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:49 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 1 -alpha off txt:- 2024-12-04 21:11:49 – These 6 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 -alpha off txt:- 2024-12-04 21:11:49 – These 6 args: rose: -type palette -depth 2 …/work/.tmp/Nw8NZsOVgL/colormap.png 2024-12-04 21:11:49 – These 2 args: …/work/.tmp/Nw8NZsOVgL/colormap.png …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:49 – These 8 args: -depth 1 -size 6x1 pattern:gray50 -alpha on …/work/.tmp/Nw8NZsOVgL/test.tif 2024-12-04 21:11:49 – These 6 args: …/work/.tmp/Nw8NZsOVgL/out.png -depth 1 -alpha off txt:- 2024-12-04 21:11:49 – These 6 args: …/work/.tmp/Nw8NZsOVgL/test.tif -depth 1 -alpha off txt:-
t/tiff.t line #159 has ' instead of \", nothing else changed. Where have all the quotes gone? How would convert know when the caption ends? (I am a shell, not a Perl programmer.)
The work directory is created by MacPorts and has
/opt/local/var/macports/build/_Users_alpha_ports_perll_p5-pdf-builder/p5.34-pdf-builder/work: insgesamt 4 drwxr-xr-x 6 macports wheel 238 4. Dez 21:11 . drwxr-xr-x 3 macports wheel 102 4. Dez 21:10 .. drwxr-xr-x 2 macports wheel 68 4. Dez 21:10 .home -rw-r--r-- 1 macports wheel 313 4. Dez 21:11 .macports.p5.34-pdf-builder.state drwxr-xr-x 2 macports wheel 136 4. Dez 21:11 .tmp drwxr-xr-x 12 macports wheel 850 4. Dez 21:11 PDF-Builder-3.026 drwxr-xr-x 3 root wheel 102 4. Dez 21:11 destroot
In destroot a hierarchy of the files to install on the system is built.
-- Greetings
Pete
Competition is the great eroder of profits.
Making your tiff test script perform:
system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\"A caption back-double for the image\" $tiff_f");
system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:\'A caption back-single for the image\' $tiff_f");
system("$convert -depth 1 -gravity center -pointsize 78 -size ${width}x${height} caption:'A caption single for the image' $tiff_f");
I get recorded
2024-12-04 22:21:35 – 10 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption back-double for the image …/work/.tmp/lBzeHj5O1M/test.tif
2024-12-04 22:21:35 – 10 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption back-single for the image …/work/.tmp/lBzeHj5O1M/test.tif
2024-12-04 22:21:36 – 10 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption single for the image …/work/.tmp/lBzeHj5O1M/test.tif
Trying it myself on the command line:
pete 826 /\ convert -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:"A caption for the image" test.tif
I got
2024-12-04 21:58:58 – 10 args: -depth 1 -gravity center -pointsize 78 -size 1000x100 caption:A caption for the image test.tif
Ten arguments – consistently!
Another option would be to use only one word, "C-a-PiT-o-N", as caption. (Although it could encourage users to complain that the word is misspelled…)
-- Greetings
Pete
This signature is currently under construction.
Building and testing happen inside the MacPorts package manager:
The source archive contains two TIFF files:
Is the missing 'test.tif' file created from some test?