Bug 46065

Summary: init.d/functions fail if ksh option '-u' is enabled
Product: [Retired] Red Hat Linux Reporter: Alain D D Williams <addw>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-06-27 14:37:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
alain sent a file in an email with his proposed fix (thanks!) none

Description Alain D D Williams 2001-06-26 16:43:40 UTC
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 14:37:37 UTC
Created attachment 21946 [details]
alain sent a file in an email with his proposed fix (thanks!)

Comment 2 Bill Nottingham 2001-07-09 05:19:30 UTC
those fixes will be applied in the first release *after* 5.99-1; thanks!