Help save net neutrality! Learn more.
Close

#7 pfsinhdrgen fails silently on pfsin failure.

closed-fixed
nobody
None
5
2010-10-06
2007-08-02
No

I built pfs{tools-1.6.2,tmo-1.1,calibrate-1.3} myself today, and attempted to run through some sample images. I hadn't noticed that I didn't have PPM libraries properly set up or installed, and running pfsinhdrgen didn't give me any output.

First, pfsinhdrgen doesn't check for a failure to load any of the images; it ignores errors in loading, which leads to the next stage failing. The relevant line is:

system "pfsin $file 2> /dev/null | pfstag --set \"BV=$Bv\"\n";

which should be changed to something more like:

system("pfsin $file 2> /dev/null | pfstag --set \"BV=$Bv\"\n") == 0
or die "Failed to open image '$file'";

However, this in and of itself doesn't fix the issue; pfsin returns success (0) even when it fails to run.

$ pfsin -v test1.jpg; echo $?
jpegtopnm: WRITING PPM FILE
/usr/local/bin/pfsin: line 107: pfsinppm: command not found
0

This is part of a set of if-else alternators which check for imgmagick, then attempt to use netpbm. Where the logic is currently along the lines of:

if imagemagic available; then
use imagemagick
else
use netpbm

it should be more like:

if imagemagic available; then
use imagemagick
else if netpbm available; then
use netpbm
else
print an error
exit 1

Discussion

  • Rafal Mantiuk

    Rafal Mantiuk - 2010-10-06

    pfsin now reports an error if both NetPBM and ImageMagick are missing.

    Catching an error in pfsinhdrgen:

    system("pfsin $file 2> /dev/null | pfstag --set \"BV=$Bv\"\n") == 0

    will not work because "system" returns the error status from the last command in the pipe. $PIPESTATUS could provide such information but it is bash only.

     
  • Rafal Mantiuk

    Rafal Mantiuk - 2010-10-06
    • status: open --> closed-fixed
     

Log in to post a comment.