Bug 139988

Summary: 'tcsh -e' doesn't work due to poorly written colorls.csh
Product: [Fedora] Fedora Reporter: Chris Colohan <colohan+redhat>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: mitr
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 5.2.1-33 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-25 12:10:23 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Don't run commands that could exit with non-zero exit code none

Description Chris Colohan 2004-11-18 23:41:51 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
If I try to write a shell script with "tcsh -e", it just doesn't work.
 The reason is because the file /etc/profile.d/colorls.csh contains
the line:

test -f ~/.dircolors

-- this sets the return code to be non-zero unless the file .dircolors
exists, and causes the shell to abort.

The workaround is:  erase the file /etc/profile.d/colorls.csh

The fix is to fix up this shell script so it doesn't rely on testing
the return code of the test command.


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

How reproducible:
Always

Steps to Reproduce:
1. Create a shell script with the following contents:
#!/bin/tcsh -e
echo "Hi"

2. Try to run it.



Actual Results:  It doesn't print "Hi".

Expected Results:  Print "Hi".

To show what is happening in detail, use "#!/bin/tcsh -eX"


Additional info:
Comment 1 Miloslav Trmač 2004-11-25 07:33:01 EST
The 'test' commands can be avoided, but AFAICS
there is no way to avoid the egrep, and (tcsh -e) will exit
even if the egrep is executed while evaluating a controlling
expression of the 'if' command.
Comment 2 Tim Waugh 2004-11-25 08:53:51 EST
So what's the answer?
Comment 3 Miloslav Trmač 2004-11-25 10:02:53 EST
Created attachment 107460 [details]
Don't run commands that could exit with non-zero exit code

To think again :)

The attached patch should fix it. It assumes GNU sed, which is probably
not a problem.

Sorry for reassigning, I have confused the file with lang.csh.
Comment 4 Tim Waugh 2004-11-25 12:10:23 EST
Thanks for the patch!  I've built this as coreutils-5.2.1-33.