Bug 1410903

Summary: tcsh -e flag is broken
Product: Red Hat Enterprise Linux 7 Reporter: Angelo Bonet <angelotech>
Component: tcshAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: angelotech
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-13 01:44:07 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:

Description Angelo Bonet 2017-01-06 19:32:42 UTC
Description of problem:

tcsh's -e flag prevents shell operation

Version-Release number of selected component (if applicable):

tcsh-6.18.01-8.el7.x86_64

How reproducible:

Always 

Steps to Reproduce:
1.  
# Create a script:
% echo "echo hello" > script.csh

2. 
# Run script with tcsh -e
% tcsh -e ./script.csh

3.
# See nothing at all

Actual results:

% 

Expected results:

% hello

Additional info:

It appears that starting with RHEL7, the -e flag to tcsh just renders the entire shell inoperable.

That switch is designed to force the shell to exit when a command returns non-zero exit status, but it now causes the shell to do nothing (other then exit with status 2).

This works as expected on RHEL6: tcsh-6.17-35.el6_8.1.x86_64 and RHEL5: tcsh617-6.17-7.el5

Observed that it's also broken on Fedora 24's tcsh-6.19.00-10.fc24.x86_64

Comment 2 Angelo Bonet 2017-01-09 16:01:24 UTC
I was going to open an upstream bug report, but discovered this may be an issue limited to running tcsh on RHEL7.

I've downloaded several upstream versions of tcsh (e.g. 6.18.01, 6.19, 6.20) and built them on both RHEL 6.8 and 7.3.

The RHEL 6 builds work fine with -e, but fail on RHEL 7.

Comment 3 Angelo Bonet 2017-01-11 22:11:26 UTC
Feel free to close this report as NOTABUG.  

The is not a problem with tcsh, it's the fact that the "-e" flag is being used without the "-f" flag.  This is causing "-e" to operate on the initialization scripts and (on our particular RHEL7 host) there is a 'grep' command up in /etc/profile.d/ksh.csh that exists with status 2.  

Due to -e, this causes the tcsh invocation to exit with status 2 -- well before the users script is ever invoked -- just as it should.

In our case, RHEL6 doesn't have any commands up in /etc/profile.d/*.csh that exit with a non-zero status -- so it skates through that code without a problem.

Comment 4 David Kaspar // Dee'Kej 2017-02-13 01:44:07 UTC
(In reply to Angelo Bonet from comment #3)
> Feel free to close this report as NOTABUG.  
> 
> The is not a problem with tcsh, it's the fact that the "-e" flag is being
> used without the "-f" flag.  This is causing "-e" to operate on the
> initialization scripts and (on our particular RHEL7 host) there is a 'grep'
> command up in /etc/profile.d/ksh.csh that exists with status 2.  
> 
> Due to -e, this causes the tcsh invocation to exit with status 2 -- well
> before the users script is ever invoked -- just as it should.
> 
> In our case, RHEL6 doesn't have any commands up in /etc/profile.d/*.csh that
> exit with a non-zero status -- so it skates through that code without a
> problem.

Thank you very much, Angelo, for reporting this change in behaviour between RHEL6 and RHEL7. I wasn't aware of it, this might come in handy in the future. Much appreciated.

Best regards,

David