Bug 440652

Summary: Wrong Test Syntax With Zsh
Product: [Fedora] Fedora Reporter: Mathieu Chouquet-Stringer <mathieu-acct>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: dqarras, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-07 20:34:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.