Bug 1410903 - tcsh -e flag is broken
Summary: tcsh -e flag is broken
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tcsh
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: David Kaspar [Dee'Kej]
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-06 19:32 UTC by Angelo Bonet
Modified: 2017-02-13 01:44 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-13 01:44:07 UTC
Target Upstream Version:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.