Bug 139988 - 'tcsh -e' doesn't work due to poorly written colorls.csh
'tcsh -e' doesn't work due to poorly written colorls.csh
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Depends On:
  Show dependency treegraph
Reported: 2004-11-18 23:41 EST by Chris Colohan
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: 5.2.1-33
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-11-25 12:10:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Don't run commands that could exit with non-zero exit code (1.22 KB, patch)
2004-11-25 10:02 EST, Miloslav Trmač
no flags Details | Diff

  None (edit)
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):

How reproducible:

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.

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