Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 2004 12:19:13 +0300
From:      Mike Makonnen <mtm@identd.net>
To:        Doug White <dwhite@gumbysoft.com>
Cc:        current@freebsd.org
Subject:   Re: IFS pollution from localpkg
Message-ID:  <20041003091913.GA1720@rogue.acs.lan>
In-Reply-To: <20041002151123.J37762@carver.gumbysoft.com>
References:  <20041002151123.J37762@carver.gumbysoft.com>

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

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Oct 02, 2004 at 03:18:52PM -0700, Doug White wrote:
> I guess no one changes the script_name_sep rc.conf variable to something
> more dangerous than the default space...
> 
> Anyway, I think we should investigate running local package scripts with
> IFS (and other hazardous variables) stripped using env. Or perhaps not
> play with IFS at all unless the user sets script_name_sep, and change the
> default accordingly.
> 
> I'm not sure why this doesn't mess more stuff up :-/

It looks like this particular bug has been around since that feature
was introduced in rev. 1.272 way back in July 2001. I guess people don't
use it that much.

Does the following patch fix your problem?

Cheers.
-- 
Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm@identd.net | Fingerprint: AC7B 5672 2D11 F4D0 EBF8  5279 5359 2B82 7CD4 1F55
mtm@FreeBSD.Org| FreeBSD - Unleash the Daemon !

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: etc/rc.d/localpkg
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/localpkg,v
retrieving revision 1.4
diff -u -r1.4 localpkg
--- etc/rc.d/localpkg	28 Jul 2004 00:09:18 -0000	1.4
+++ etc/rc.d/localpkg	3 Oct 2004 09:12:25 -0000
@@ -40,7 +40,7 @@
 			if [ -x "${script}" ]; then
 				(set -T
 				trap 'exit 1' 2
-				${script} start)
+				/bin/env IFS="${script_save_sep}" ${script} start)
 			elif [ -f "${script}" -o -L "${script}" ]; then
 				echo -n " (skipping ${script##*/}, not executable)"
 			fi
@@ -77,7 +77,7 @@
 			if [ -x "${script}" ]; then
 				(set -T
 				trap 'exit 1' 2
-				${script} stop)
+				/bin/env IFS="${script_save_sep}" ${script} stop)
 			fi
 		done
 		IFS="${script_save_sep}"

--X1bOJ3K7DJ5YkBrT--



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