bin/50365: [PATCH] rc.sysctl cannot handle values containing spaces

Chris Rodgers christopher.rodgers at st-johns.oxford.ac.uk
Thu Mar 27 12:20:12 PST 2003


>Number:         50365
>Category:       bin
>Synopsis:       [PATCH] rc.sysctl cannot handle values containing spaces
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 27 12:20:08 PST 2003
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list