Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 139988 - 'tcsh -e' doesn't work due to poorly written colorls.csh
Summary: 'tcsh -e' doesn't work due to poorly written colorls.csh
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 3
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-11-19 04:41 UTC by Chris Colohan
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version: 5.2.1-33
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2004-11-25 17:10:23 UTC

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

Description Chris Colohan 2004-11-19 04:41:51 UTC
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 12:33:01 UTC
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 13:53:51 UTC
So what's the answer?

Comment 3 Miloslav Trmač 2004-11-25 15:02:53 UTC
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 17:10:23 UTC
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.