Bug 426852 - Lots of initscript bugs
Lots of initscript bugs
Product: Fedora
Classification: Fedora
Component: krb5 (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Nalin Dahyabhai
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2007-12-27 07:32 EST by Greg Turner
Modified: 2008-01-02 12:04 EST (History)
1 user (show)

See Also:
Fixed In Version: 1.6.3-4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-01-02 12:04:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Greg Turner 2007-12-27 07:32:51 EST
Description of problem:
Consider the following buggy code:

# x=no [ $x = "no" ] || echo yes
-bash: [: =: unary operator expected

Similar errors are suprisingly pervasive in rhel5 and 4.  Install rpms and run 

find /etc -type f | xargs grep
'\[[[:space:]]*\${[^}]*\}[[:space:]]*=[[:space:]]*\".*\".*]' -C 2 -n --color=yes

for a nice list.

This is probably a big part of why my console is littered with stderr instead of
nice pretty green "OK" symbols during boot.

Version-Release number of selected component (if applicable):
at least rhel4 and 5.

Steps to Reproduce:
1.install, i.e., el4 krb5-server
2 run any init script from this package
3.read output on stderr
Actual results:
[: =: unary operator expected

Expected results:

Additional info:

Adding quotes around the shell var. gives apples<->apples comparison fixing problem.

Tested only on CentOS.
Comment 1 Greg Turner 2007-12-27 07:44:45 EST
oops, here is an improved version of the above script that catches more bugs:

find /etc -type f | xargs grep '\[[[:space:]]*\$[^\"]*=[[:space:]]*\".*\".*]' -C
2 -n --color=yes
Comment 2 Greg Turner 2007-12-28 17:34:46 EST
FYI I have confirmed that replacing, ie [ $foo = "bar" ] with [ "$foo" = "bar" ]
in all initscripts makes the (serial console) boot sequence pretty again.  Glad
to see fixing the bug does not seem to have broken my server in any noticable way :)
Comment 3 Nalin Dahyabhai 2008-01-02 11:41:39 EST
The instances which the grep catches (thanks for that) seem to have been fixed
for RHEL as part of bug #242500, so I'm moving this to Fedora development, which
hasn't had those changes merged, so that I don't forget to get them in for F9. 

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