Bug 46065 - init.d/functions fail if ksh option '-u' is enabled
Summary: init.d/functions fail if ksh option '-u' is enabled
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts   
(Show other bugs)
Version: 7.1
Hardware: All Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2001-06-26 16:43 UTC by Alain D D Williams
Modified: 2014-03-17 02:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-06-27 14:37:41 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 14:37 UTC, Brock Organ
no flags Details

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

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

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!

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