Bug 1219923

Summary: Inconsistent state after SIGINT during eval
Product: Red Hat Enterprise Linux 6 Reporter: Paulo Andrade <pandrade>
Component: tcshAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED ERRATA QA Contact: Iveta Wiedermann <isenfeld>
Severity: medium Docs Contact: Lenka Špačková <lkuprova>
Priority: medium    
Version: 6.6CC: dkutalek, isenfeld, ovasik
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tcsh-6.17-32.el6 Doc Type: Bug Fix
Doc Text:
*tcsh* no longer in an inconsistent state after a command interruption Interrupting the "eval sleep 10" command left the *tcsh* shell in an incosistent state. Consequently, it was necessary to press the Ctrl+D key combination twice to successfully exit the shell. With this update, *tcsh* correctly exits after pressing Ctrl+D once.
Story Points: ---
Clone Of:
: 1273500 (view as bug list) Environment:
Last Closed: 2016-05-11 00:55:32 UTC Type: Bug
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: 1172231, 1254457, 1273500    
Attachments:
Description Flags
tcsh-6.18.01-sigint-in-eval.patch
none
tcsh-6.18.01-sigint-in-eval.patch none

Description Paulo Andrade 2015-05-08 18:02:21 UTC
This was reported to upstream:

"""
Hi,

An user reported a problem, that apparently happens for quite
some time.

The user reports that interrupting this command:

eval sleep 10

would keep history in tcsh-6.14.00, but not in tcsh-6.18.01.
Actually, I believe the history not being logged is due to
http://pkgs.fedoraproject.org/cgit/tcsh.git/tree/tcsh-6.18.00-history-file-locking.patch

and the problem is another, as the inconsistent state
happens in all tcsh versions. Basically, when doeval()
calls process(), process() does not leave, so one needs
to ^D twice to get back to the consistent state.

The attached patch correct this condition, and based
on code I could read is correct, but I would like some
feedback on it.

Thanks,
Paulo
"""

Comment 2 Paulo Andrade 2015-05-08 19:34:41 UTC
Created attachment 1023589 [details]
tcsh-6.18.01-sigint-in-eval.patch

Comment 3 Paulo Andrade 2015-05-09 12:59:43 UTC
Created attachment 1023775 [details]
tcsh-6.18.01-sigint-in-eval.patch

Update patch, as initially proposed patch would
break the shell (was exiting if pressing ^C),
while the idea was to just leave the inconsistent
state after ^C during eval.

Comment 4 Fridolín Pokorný 2015-05-13 12:31:13 UTC
Thanks for the report and provided patch!

It looks OK to me and it sounds reasonable to merge this patch, no fail noted in upstream testsuite as well.

Comment 5 David Kaspar // Dee'Kej 2015-10-20 11:12:21 UTC
Here is the mailing list conversation mentioned in the comment #0:
http://mx.gw.com/pipermail/tcsh-bugs/2015-May/000925.html

Comment 6 David Kaspar // Dee'Kej 2015-10-20 11:22:03 UTC
The conversation in the mailing list might be misleading to somebody - it might look like the patch was not accepted:

> And removed. This breaks the shell completely; a ^C makes it exit.
>
> christos

However, will small tweak, the patch was accepted by the upstream:
https://github.com/tcsh-org/tcsh/commit/5376dd911afa817a802aa736a69b3c0546b2b188

Comment 8 David Kaspar // Dee'Kej 2015-12-15 13:55:29 UTC
(In reply to Paulo Andrade from comment #0)
> The user reports that interrupting this command:
> 
> eval sleep 10
> 
> would keep history in tcsh-6.14.00, but not in tcsh-6.18.01.

This actually does not aplly for the RHEL-6, since we use a different source base (tcsh-6.17.00).

It might apply for the RHEL-7, but I'm not able to acquire a testing machine at the moment. I will try to test it tomorrow and if I see any ~/.history file corruption, I would create a separate BZ for it.

Regarding this part:
> and the problem is another, as the inconsistent state
> happens in all tcsh versions. Basically, when doeval()
> calls process(), process() does not leave, so one needs
> to ^D twice to get back to the consistent state.

I have applied the patch and it should be part of the errata for RHEL-6.8.

Comment 9 David Kaspar // Dee'Kej 2015-12-16 11:40:05 UTC
I'm sorry, but I was not able to reproduce the ~/.history file corruption on RHEL-7 machine either (tcsh-6.18.01-8.el7.x86_64).

Therefore, unless you or somebody else provide us with info how to reproduce the ~/.history file corruption, we can't help you with that matter. If that matter persists for you, feel free to create a separate BZ for it.

Thank you for your understanding.

Comment 13 errata-xmlrpc 2016-05-11 00:55:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0938.html