Bug 440652 - Wrong Test Syntax With Zsh
Summary: Wrong Test Syntax With Zsh
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-04 12:32 UTC by Mathieu Chouquet-Stringer
Modified: 2008-04-07 20:34 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-04-07 20:34:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mathieu Chouquet-Stringer 2008-04-04 12:32:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008040216 Fedora/3.0-0.52.beta5.fc9 Firefox/3.0b5

Description of problem:
On line 21 in /etc/profile.d/colorls.sh, there's a test that reads like that:
      [ "`tput colors 2>/dev/null`" == "256" ] && \

I use zsh as my shell and zsh doesn't use the double = test as demonstrated in this example:
mchouque - /etc/profile.d %[ a == b ] && echo true
zsh: = not found
mchouque - /etc/profile.d %[[ a == b ]] && echo true   

Ie in the man page, it says [ is like the system version of test which clearly doesn't support == to compare two strings (zsh will only support it if you use the [[ compound command).

So I guess the test should be changed to
      [ "`tput colors 2>/dev/null`" = "256" ] && \

Comments?

Best,
Mathieu

Version-Release number of selected component (if applicable):
6.10-17.fc9

How reproducible:
Always


Steps to Reproduce:
1. use zsh as system shell
2. source /etc/profile.d/colorls.sh
3. you get /etc/profile.d/colorls.sh:21: = not found


Actual Results:


Expected Results:


Additional info:

Comment 1 Daniel Qarras 2008-04-07 17:33:05 UTC
In brief, this is clearly just a bashism in the colorls.sh script, the POSIX way
is to use "=" instead of "==".

For the sake of us who prefer other shells than bash, please fix colorls.sh. Thanks.

Comment 2 Ondrej Vasik 2008-04-07 20:34:32 UTC
Thanks for report. Sorry for troubles and that bashism. Fixed in
coreutils-6.10-18.fc9. Closing RAWHIDE.


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