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   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-07 16:34:32 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Mathieu Chouquet-Stringer 2008-04-04 08:32:03 EDT
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" ] && \



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

How reproducible:

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 13:33:05 EDT
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 16:34:32 EDT
Thanks for report. Sorry for troubles and that bashism. Fixed in
coreutils-6.10-18.fc9. Closing RAWHIDE.