Subject: misc/4887: /etc/rc.conf insistance on uppercase YES/NO is mildly irritating
To: None <gnats-bugs@gnats.netbsd.org>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: netbsd-bugs
Date: 01/25/1998 12:23:39
>Number:         4887
>Category:       misc
>Synopsis:       /etc/rc.conf insistance on uppercase YES/NO is mildly irritating
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 25 09:35:01 1998
>Last-Modified:
>Originator:     John F. Woods
>Organization:
Misanthropes-R-Us
>Release:        NetBSD 1.3 release
>Environment:
	
System: NetBSD jfwhome.funhouse.com 1.3 NetBSD 1.3 (JFW) #0: Fri Jan 16 11:55:17 EST 1998 root@jfwhome.funhouse.com:/usr/src/sys/arch/i386/compile/JFW i386


>Description:
	Portmap wasn't starting up on my system because I had entered
"portmap=yes" instead of "portmap=YES" in /etc/rc.conf.  Although the
documentation does say that it must be YES or NO, this is a very natural
mistake to make, especially if you're in a hurry, and it's fixable with so
little cost.  (My proposed fix assumes that "Yes" and "No" are relatively
unlikely and thus don't need to be handled.)

>How-To-Repeat:
	Make the above mistake.  Reboot.  Wonder why RPC programs hang
during initialization.

>Fix:
	Change /etc/rc.subr as follows:

#	$NetBSD: rc.subr,v 1.2 1997/08/30 03:34:29 cjs Exp $
# functions used by various rc scripts

# Test $1 variable, and warn if not set to YES or NO.
checkyesno() {
	eval value=\$${1};
	if [ "$value" = YES -o "$value" = yes ]; then
		return 0;
	else
		if [ "$value" != NO -a "$value" != no ]; then
			logger -s "WARNING: \$${1} is not set properly."
		fi
		return 1;
	fi
}

>Audit-Trail:
>Unformatted: