[sane-devel] Strange (new) issue with scanadf -S script --script-wait

Raman Gupta rocketraman at gmail.com
Thu Aug 29 17:02:23 UTC 2013

I have been happily using scanadf with the -S script --script-wait
parameters for a couple of years.

My script converts the image data to pdf, via a call to pnmtops, piped
through ps2pdf.

However recently (I suspect since I updated from Fedora 17 to 19), the
called script hangs, and therefore scanadf hangs. The script is hung
at the pnmtops command. The pnmtops command itself is waiting for its
forked "child" pnmtops output filter to complete, and it never does.

Running the scan_perpage script directly works fine. Running the
pnmtops command directly works fine. It is only when run from scanadf
via -S that the script hangs at pnmtops.


# rpm -q --info sane-backends
Name        : sane-backends
Version     : 1.0.23
Release     : 13.fc19

# rpm -q --info sane-frontends
Name        : sane-frontends
Version     : 1.0.14
Release     : 16.fc19

# rpm -q --info netpbm
Name        : netpbm
Version     : 10.61.02
Release     : 5.fc19

Here is the output of my scan script, which calls scanadf -vv:

$ scan -o output.pdf
scanadf: value for --resolution is: 300
scanadf: scanning image of size 2544x3300 pixels at 1 bits/pixel
scanadf: acquiring gray frame
Started script `/usr/local/bin/scan_perpage' as pid=10902
Scanned document scan-0001
pnmtops: Input maxval is 1.  Postscript raster will have 1 bits per
sample, so maxval = 1
pnmtops: Image will be 610.56 points wide by 792.00 points high, left
edge 0.72 points from left edge of page, bottom edge 0.00 points from
bottom of page; NOT turned to landscape orientation
pnmtops: output filter spawned: pid 10904
pnmtops: Waiting for PID 10904 to exit
Scanned 1 pages

Here is the process tree at the point of the hang:

10897 32072 /bin/sh /usr/local/bin/scan -o output.pdf
10898 10897 scanadf -vvv -d fujitsu -S /usr/local/bin/scan_perpage
--script-wait --resolution 300 --mode Lineart -o scan-%04d
10902 10898 /bin/bash /usr/local/bin/scan_perpage scan-0001
10903 10902 pnmtops -verbose -imagewidth 8.5 -imageheight 11 scan-0001
10904 10903 pnmtops -verbose -imagewidth 8.5 -imageheight 11 scan-0001

Process 10904 (the forked pnmtops "output filter") never finishes. An
strace indicates it is waiting on a "read".

I can't figure out why pnmtops hangs when called via scanadf, but when
called directly it works perfectly fine.

Any ideas?


More information about the sane-devel mailing list