Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Oct 2012 22:29:16 +0100 (BST)
From:      Chris Rees <crees@physics.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   conf/173088: [PATCH] rc.subr breaks with spaces in ${name}_chroot
Message-ID:  <20121025212916.E6AFC4D1BC@pegasus.bayofrum.net>
Resent-Message-ID: <201210252140.q9PLe0Ik008468@freefall.freebsd.org>

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

>Number:         173088
>Category:       conf
>Synopsis:       [PATCH] rc.subr breaks with spaces in ${name}_chroot
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 25 21:40:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Chris Rees
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD pegasus.bayofrum.net 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Sun Apr 29 12:29:02 BST 2012 root@pegasus.bayofrum.net:/usr/obj/usr/src/sys/PEGASUS amd64


	
>Description:
	A guy in IRC pointed out to me that rc.subr will not work correctly if
a chroot has spaces in it.

	Although this is unlikely, would it hurt to include it?
>How-To-Repeat:
	
>Fix:

	

--- rc-subr-support-chroot-spaces.diff begins here ---
Index: rc.subr
===================================================================
--- rc.subr	(revision 241356)
+++ rc.subr	(working copy)
@@ -261,8 +261,8 @@
 
 	_pref=
 	if [ $_interpreter != "." ]; then	# an interpreted script
-		_script=${_chroot}${_chroot:+"/"}$_procname
-		if [ -r $_script ]; then
+		_script="${_chroot}${_chroot:+/}$_procname"
+		if [ -r "$_script" ]; then
 			read _interp < $_script	# read interpreter name
 			case "$_interp" in
 			\#!*)
@@ -705,7 +705,7 @@
 				return 1
 			fi
 
-			if [ ! -x ${_chroot}${_chroot:+"/"}${command} ]; then
+			if [ ! -x "${_chroot}${_chroot:+/}${command}" ]; then
 				warn "run_rc_command: cannot run $command"
 				return 1
 			fi
--- rc-subr-support-chroot-spaces.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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