Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2002 01:52:22 +0400 (MSD)
From:      Sergey Mokryshev <mokr@mokr.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   conf/44282: /etc/rc.d/sysctl script works incorrectly in case of non-existent  MIB
Message-ID:  <200210192152.g9JLqMQj000899@amber.mokr.ru>

next in thread | raw e-mail | index | archive | help

>Number:         44282
>Category:       conf
>Synopsis:       /etc/rc.d/sysctl script works incorrectly in case of non-existent  MIB
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 19 15:00:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Sergey Mokryshev
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Tersys
>Environment:
System: FreeBSD amber.mokr.net 5.0-CURRENT FreeBSD 5.0-CURRENT #12: Sun Oct 20 00:40:36 MSD 2002 su@amber.mokr.net:/.1/a/obj/.1/a/src/sys/AMBER_UP i386


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

>Fix:

--- /tmp/sysctl.orig	Sun Oct 20 01:08:03 2002
+++ sysctl	Sun Oct 20 01:23:04 2002
@@ -49,7 +49,7 @@
 						sysctl ${var}
 						;;
 					esac
-				elif [ "$1" -eq "last" ]; then
+				elif [ "$?" -ne "0" ]; then
 					warn "sysctl ${mib} does not exits."
 				fi
 				;;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210192152.g9JLqMQj000899>