[sane-devel] scanadf --scan-script giving me troubles when used in screen environment

Jelle de Jong jelledejong at powercraft.nl
Fri Jan 30 00:39:33 UTC 2009

Hash: SHA1

Jelle de Jong wrote:
> Hello everybody,
> I have developed this tool that uses scanadf:
> https://secure.powercraft.nl/svn/packages/trunk/deb/pct-scanner-scripts/pct-scanner-scripts-devel/
> It is also waiting for sponsoring to be included into debian:
> http://mentors.debian.net/debian/pool/main/p/pct-scanner-scripts
> The tool works fine run from the command line but when trying to
> integrate it with keyboard shortcuts i run into serious trouble. I
> spent a hole day trying to debug it without luck.
> The script called from scanadf closes unexpected when executing a
> command like c44 of convert, i first thought it was a bug in convert
> so i made this bug report, see the attachment for info:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513493
> But then after further testing I had exactly the same issue with c44
> command.
> It only happens when my tool is not directly executed form a terminal.
> If i run this from a normal xterm of xfce4-terminal it goes wrong:
> screen -S scanner /usr/bin/pct-scanner-script --config color2 --clean
> or
> /usr/bin/xfce4-terminal --hold --execute /usr/bin/pct-scanner-script
> --config color2
> So its not only with screen i get this issue....
> Both above command result in an unexpected exit of the child script
> used by scanadf.
> I also simplified the script that is called form scanadf but it just
> dies unexpected when called: see: http://debian.pastebin.com/d5f169270
> I am complete lost here, I have been pulling out my remaining hairs
> for this hole day :-(
> I can both duplicate this issue on two different machines one lenny
> and one sid.
> Please help,
> Best regards,
> Jelle de Jong

Hello everybody,

After more debugging with strace I discovered that the running command
received a SIGHUP [1] singal, I tried all kind of things like wait,
nohup, disown to keep the script called by scanadf running, but no
luck. [1] --- SIGHUP (Hangup) @ 0 (0) ---

So I created an evil workaround with file status flags, this seems to
be working well and waits until the child is finished before closing
itself, for the full commit diff see:

I think the scanadf code, that call the process script is kind of
broken, it does not allow for extra arguments (only exported envs) and
it does not allow "nohup /path/of/script --argument $file" as argument.

Beside this the spawning process of scanadf used for the script is
like evil black magic for me ... :-(

It took way to much time to debug this issues, the workaround did not
take so much time though.

Would somebody be willing to take a look at the scanadf code and if
possible enhance it. We can talk about some sort of bounty/reward for
the possible work.

Thanks in advance,

Jelle de Jong
Version: GnuPG v1.4.9 (GNU/Linux)


More information about the sane-devel mailing list