Red Hat Bugzilla – Bug 177366
tcsh scripts do not allow programs to run sigint handlers with Ctrl-C
Last modified: 2016-04-27 02:54:44 EDT
Description of problem:
A tcsh script (attached) does not allow for long running processes (test case
attached) to execute their signal handler, before pulling the rug out from
underneath them. This is not a problem in bash, nor is it a problem in tcsh 6.12.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Execute shell script ./testrl.csh
3. Attempt to use interrupt handler
Interrupt handler is started and then aborted.
Interrupt handler is able to run as it would in bash.
Adding 'onintr -' before the ./testrl in the script allows the interrupt handler
to execute as expected. This was not required previously, and breaks tcsh
compatibility. I checked for an 'onintr' statement in any config files from
Redhat 8, none were found.
Compile testrl.c with `gcc -o testrl testrl.c -lreadline -lhistory -lcurses`
Created attachment 122981 [details]
Created attachment 122982 [details]
Run (from csh or bash) with ./testrl.csh
Created attachment 122984 [details]
trimmed strace.log from 6.14
`strace -f -o /tmp/strace-tcsh-6.14.log ./testrl.csh`
It is worth noting that the signal handler behaves correctly inside strace.
The sleep() is on line 212.
Created attachment 122985 [details]
trimmer strace.log from 6.12
strace -f -o /tmp/strace-tcsh-6.12.log /share/temp/tcsh testrl.csh
The sleep() is on line 181.
Notice here that "killed by SIGINT" is on line 261 (ie. the end) rather than,
215 (which is before the interrupt handler in the testrl binary).
It is worth noting here that everything behaves normally if you send SIGINT to
testrl, ie. `killall -INT testrl`.
(I had some trouble identifying the failure, so for future reference:)
tcsh does not block SIGINT while waiting on children and can thus be killed
before the child process.
The example program SIGSEGV's on Ctrl+D in readline, but that is irrelevant.
Please test tcsh-6.14-1.fc4.1 in Fedora Core testing updates repository.
tcsh-6.14-6.fc5.1 has been pushed for FC5, which should resolve this issue. If these problems are still present in this version, then please make note of it in this bug report.
Thanks for your report.