From chris@stu172.sjc.ox.ac.uk  Thu Mar 27 12:11:19 2003
Return-Path: <chris@stu172.sjc.ox.ac.uk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 48C3837B405
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 27 Mar 2003 12:11:19 -0800 (PST)
Received: from stu172.sjc.ox.ac.uk (stu172.sjc.ox.ac.uk [129.67.62.172])
	by mx1.FreeBSD.org (Postfix) with ESMTP id F3F2043FA3
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 27 Mar 2003 12:11:17 -0800 (PST)
	(envelope-from chris@stu172.sjc.ox.ac.uk)
Received: from stu172.sjc.ox.ac.uk (localhost [127.0.0.1])
	by stu172.sjc.ox.ac.uk (8.12.6/8.12.6) with ESMTP id h2RKAGkW001226;
	Thu, 27 Mar 2003 20:10:16 GMT
	(envelope-from chris@stu172.sjc.ox.ac.uk)
Received: (from root@localhost)
	by stu172.sjc.ox.ac.uk (8.12.6/8.12.6/Submit) id h2RKAFAD001225;
	Thu, 27 Mar 2003 20:10:15 GMT
Message-Id: <200303272010.h2RKAFAD001225@stu172.sjc.ox.ac.uk>
Date: Thu, 27 Mar 2003 20:10:15 GMT
From: Chris Rodgers <christopher.rodgers@st-johns.oxford.ac.uk>
Reply-To: Chris Rodgers <christopher.rodgers@st-johns.oxford.ac.uk>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Chris Rodgers <christopher.rodgers@st-johns.oxford.ac.uk>
Subject: [PATCH] rc.sysctl cannot handle values containing spaces
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         50365
>Category:       conf
>Synopsis:       [PATCH] rc.sysctl cannot handle values containing spaces
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 27 12:20:08 PST 2003
>Closed-Date:    Sat Feb 25 01:32:31 GMT 2006
>Last-Modified:  Sat Feb 25 01:32:31 GMT 2006
>Originator:     Chris Rodgers
>Release:        FreeBSD 5.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD stu172.sjc.ox.ac.uk 5.0-RELEASE FreeBSD 5.0-RELEASE #0: Thu Jan 16 22:16:53 GMT 2003 root@hollin.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC i386

>Description:
The /etc/rc.sysctl script cannot handle sysctl values containing spaces (such as net.link.ether.bridge_cfg). Wrapped the whole assignment in quotes to make this work. Added a note to the man page explaining how spaces are to be quoted.
>How-To-Repeat:
Attempt to put an entry in /etc/sysctl.conf for a value containing a space. It is mangled by the rc.sysctl script.
>Fix:
The following patch seems to work for me. This is my first FreeBSD PR, so it should probably be checked. I don't know whether there are other places which also need fixing.

--- rc.sysctl.diff begins here ---
*** /etc/rc.sysctl	Thu Jan 16 20:30:28 2003
--- rc.sysctl	Thu Mar 27 19:47:22 2003
***************
*** 45,51 ****
  				case ${current_value} in
  				${val}) ;;
  				*)
! 					sysctl ${var}
  					;;
  				esac
  			else
--- 45,51 ----
  				case ${current_value} in
  				${val}) ;;
  				*)
! 					sysctl "${var}"
  					;;
  				esac
  			else
--- rc.sysctl.diff ends here ---

--- sysctl.conf.5.diff begins here ---
*** sysctl.conf.5	Thu Mar 27 19:53:26 2003
--- sysctl.conf.5.new	Thu Mar 27 19:55:17 2003
***************
*** 43,49 ****
  sysctl_mib=value
  .Ed
  .Pp
! Comments are denoted by a
  .Dq #
  at the beginning of a line.  Comments can also exist at the end of a line,
  as seen in the
--- 43,50 ----
  sysctl_mib=value
  .Ed
  .Pp
! Spaces must be escaped with a backslash. Do not enclose the value in
! quotation marks. Comments are denoted by a
  .Dq #
  at the beginning of a line.  Comments can also exist at the end of a line,
  as seen in the
--- sysctl.conf.5.diff ends here ---


>Release-Note:
>Audit-Trail:

From: Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
To: freebsd-gnats-submit@FreeBSD.org,
	christopher.rodgers@st-johns.oxford.ac.uk
Cc:  
Subject: Re: Re: bin/50365: [PATCH] rc.sysctl cannot handle values containing spaces
Date: Tue, 7 Oct 2003 12:28:58 +0200

 I'd like to see this fixed, too.
 The original patch doesn't apply on -current anymore (because of
 the new /etc/rc.d), though. Below is an updated version.
 
 
 Index: etc/rc.d/sysctl
 ===================================================================
 RCS file: /ncvs/src/etc/rc.d/sysctl,v
 retrieving revision 1.12
 diff -u -r1.12 sysctl
 --- etc/rc.d/sysctl	24 Apr 2003 08:20:47 -0000	1.12
 +++ etc/rc.d/sysctl	7 Oct 2003 07:47:52 -0000
 @@ -46,7 +46,7 @@
  					${val})
  						;;
  					*)
 -						sysctl ${var}
 +						sysctl "${var}"
  						;;
  					esac
  				elif [ "$1" = "last" ]; then
 Index: share/man/man5/sysctl.conf.5
 ===================================================================
 RCS file: /ncvs/src/share/man/man5/sysctl.conf.5,v
 retrieving revision 1.15
 diff -u -r1.15 sysctl.conf.5
 --- share/man/man5/sysctl.conf.5	9 Jan 2002 16:09:00 -0000	1.15
 +++ share/man/man5/sysctl.conf.5	7 Oct 2003 07:34:07 -0000
 @@ -43,6 +43,8 @@
  sysctl_mib=value
  .Ed
  .Pp
 +Spaces must be escaped with a backslash.
 +Do not enclose the value in quotation marks.
  Comments are denoted by a
  .Dq #
  at the beginning of a line.  Comments can also exist at the end of a line,
State-Changed-From-To: open->feedback 
State-Changed-By: dougb 
State-Changed-When: Wed Feb 22 02:16:36 UTC 2006 
State-Changed-Why:  

rc.sysctl is long gone, is this issue still a problem for you? 




Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Wed Feb 22 02:16:36 UTC 2006 
Responsible-Changed-Why:  

I'll handle the feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50365 
State-Changed-From-To: feedback->closed 
State-Changed-By: dougb 
State-Changed-When: Sat Feb 25 01:32:06 UTC 2006 
State-Changed-Why:  

Originator reports this is no longer a problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=50365 
>Unformatted:
