Bug 177366

Summary: tcsh scripts do not allow programs to run sigint handlers with Ctrl-C
Product: [Fedora] Fedora Reporter: Davyd <davyd>
Component: tcshAssignee: Miloslav Trmač <mitr>
Status: CLOSED ERRATA QA Contact: Bill Huang <bhuang>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 6.14-6.fc5.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 884937 (view as bug list) Environment:
Last Closed: 2006-03-20 19:33:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 884937, 1330850    
Attachments:
Description Flags
testrl.c
none
testrl.csh
none
trimmed strace.log from 6.14
none
trimmer strace.log from 6.12 none

Description Davyd 2006-01-10 03:14:33 UTC
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):
tcsh-6.14-1

How reproducible:
Always.

Steps to Reproduce:
1. Execute shell script ./testrl.csh
2. Ctrl-C
3. Attempt to use interrupt handler
  
Actual results:
Interrupt handler is started and then aborted.

Expected results:
Interrupt handler is able to run as it would in bash.

Additional info:
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`

Comment 1 Davyd 2006-01-10 03:14:33 UTC
Created attachment 122981 [details]
testrl.c

Comment 2 Davyd 2006-01-10 03:16:12 UTC
Created attachment 122982 [details]
testrl.csh

Run (from csh or bash) with ./testrl.csh

Comment 3 Davyd 2006-01-10 03:23:00 UTC
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.

Comment 4 Davyd 2006-01-10 03:26:03 UTC
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).

Comment 5 Davyd 2006-01-10 03:28:19 UTC
It is worth noting here that everything behaves normally if you send SIGINT to
testrl, ie. `killall -INT testrl`.

Comment 6 Miloslav Trmač 2006-01-11 10:24:07 UTC
(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.

Comment 7 Miloslav Trmač 2006-02-19 05:39:45 UTC
Please test tcsh-6.14-1.fc4.1 in Fedora Core testing updates repository.

Comment 8 Fedora Update System 2006-03-20 16:33:40 UTC
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.

Comment 9 Miloslav Trmač 2006-03-20 19:33:37 UTC
Thanks for your report.