Bug 46065 - init.d/functions fail if ksh option '-u' is enabled
init.d/functions fail if ksh option '-u' is enabled
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
7.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-26 12:43 EDT by Alain D D Williams
Modified: 2014-03-16 22:21 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-27 10:37:41 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)
alain sent a file in an email with his proposed fix (thanks!) (8.77 KB, text/plain)
2001-06-27 10:37 EDT, Brock Organ
no flags Details

  None (edit)
Description Alain D D Williams 2001-06-26 12:43:40 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.14-12b i686)

Description of problem:
OK: I know that I am strange, but I like to catch bugs early in shell
scripts.
One common bug is using an unset variable, the ksh -u option catches this
and so I use it on all new scripts that I write.

The problem is where init.d/functions does things like:
	[ -z "$COLUMNS" ] && COLUMNS=80
the script aborts since $COLUMNS is unset.

The way to fix this is to replace the line with:
	[ -z "${COLUMNS:-}" ] && COLUMNS=80
This fix in no way breaks existing scripts.

I have fixed the script on my box and will send it as an attachment when I
get the mail in reply to opening this bug.

How reproducible:
Always

Steps to Reproduce:
1. Append -u to the first line of any script in /etc/rc.d/init.d
2. Reboot the machine
3.
	

Actual Results:  You will get a message about COLUMNS not being defined,
and then the script dies.

Additional info:
Comment 1 Brock Organ 2001-06-27 10:37:37 EDT
Created attachment 21946 [details]
alain sent a file in an email with his proposed fix (thanks!)
Comment 2 Bill Nottingham 2001-07-09 01:19:30 EDT
those fixes will be applied in the first release *after* 5.99-1; thanks!

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