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

Simon Matter simon.matter at invoca.ch
Fri Jan 30 08:21:03 UTC 2009


> -----BEGIN PGP SIGNED MESSAGE-----
> 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) ---

Am I correct that your script is called from scanadf and it then receives
SIGHUP after some time of running? If yes, did you try disabling bash's
standard SIGHUP handling (which is to send SIGHUP also to it's children)

trap "" SIGHUP

IIRC another problem can be vanishing filedescriptors, like STDIN going
missing. I see that you run some programs in background with nohup. If you
want them to run completely independant you could try runnning them with
disconnected filedescriptors, like

program <&- >&- 2>&- &

Of course that can be impossible if you need them but depending of how
your program works it may be a solution.

Regards,
Simon




More information about the sane-devel mailing list