Bug 426852 - Lots of initscript bugs
Summary: Lots of initscript bugs
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: krb5
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-12-27 12:32 UTC by Greg Turner
Modified: 2008-01-02 17:04 UTC (History)
1 user (show)

Fixed In Version: 1.6.3-4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-02 17:04:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Greg Turner 2007-12-27 12:32:51 UTC
Description of problem:
Consider the following buggy code:

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

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:
silence

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 12:44:45 UTC
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 22:34:46 UTC
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 16:41:39 UTC
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. 
Thanks!


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