Bug 440652 - Wrong Test Syntax With Zsh
Wrong Test Syntax With Zsh
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-04 08:32 EDT by Mathieu Chouquet-Stringer
Modified: 2008-04-07 16:34 EDT (History)
2 users (show)

See Also:
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: ---


Attachments (Terms of Use)

  None (edit)
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" ] && \

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 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.

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