Bug 44282

Summary: /etc/rc.d/sysctl script works incorrectly in case of non-existent MIB
Product: Base System Reporter: Sergey Mokryshev <mokr>
Component: confAssignee: Mike Makonnen <mtm>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Sergey Mokryshev 2002-10-19 23:00:03 UTC
	/sbin/sysctl does not return anything printable upon request 
	(sysctl -n ${mib}) of a non-existent variable, just an error-code.
	The code in 'elif' clause in /etc/rc.d/sysctl

        elif [ "$1" -eq "last" ]; then
          warn "sysctl ${mib} does not exits."
        fi

	is probably wrong

How-To-Repeat: 	
	Put a non-existent variable in /etc/sysctl.conf 
	and reboot. There will be message like (taken from /var/log/console.log)

	Oct 20 00:22:44 amber kernel: [: : bad number
Comment 1 Bill Fenner 2002-10-26 01:24:19 UTC
This appears to be an attempt to preserve /etc/rc.sysctl's
original functionality, which was to run twice -- the early
run would not complain about illegal sysctl variables, presumably to
allow sysctl.conf to contain variables that were in modules that would
be loaded later.

If one runs "/etc/rc.d/sysctl lastload", you get the right behavior --
however, there doesn't seem to be any provision to ever run
"/etc/rc.d/sysctl lastload".  I don't know enough about the rc.d system
to know how to fix it -- perhaps an /etc/rc.d/sysctllast which runs
/etc/rc.d/sysctl lastload?

Alternately, if we are going to abandon the multiple sysctl.conf loads,
the elif should just be turned into an else, the additional test of $?
is not necessary.

  Bill
Comment 2 Kris Kennaway freebsd_committer freebsd_triage 2003-07-13 00:49:37 UTC
Responsible Changed
From-To: freebsd-bugs->mtm

Assign to rcng maintainer
Comment 3 Mike Makonnen freebsd_committer freebsd_triage 2003-07-13 03:04:07 UTC
State Changed
From-To: open->closed

Bill is right, the script is supposed to be run twice, and the warning 
is shown only if called with the last argument. As for the problem 
of not being called twice in the boot sequence, that's already 
fixed.