[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 1/2] utils: escape arguments in fakeroot.sh



>>>>> Justus Winter <4winter@informatik.uni-hamburg.de> writes:

[…]

 > * utils/fakeroot.sh: Escape arguments handed to /bin/sh so that they
 > are not evaluated prematurely.

[…]

 >  exec /bin/settrans --chroot \
 > -     /bin/fakeauth /bin/sh -c "cd `pwd`; $*" \
 > +     /bin/fakeauth /bin/sh -c "cd `pwd`; exec ${TARGET}" \
 >       -- / /hurd/fakeroot

	… This made me wonder if we can avoid making a single string of
	the command passed, just for the /bin/sh to parse it later?
	Like (untested):

exec /bin/settrans --chroot \
     /bin/fakeauth /bin/sh \
         -c 'cd "$1" || exit ; shift ; exec "$@"' \
         dummy.sh "$(pwd)" "$@" \
     -- / /hurd/fakeroot

	(Also to note is that `pwd` may generally contain whitespace
	characters, and thus should be double-quoted, too.)

-- 
FSF associate member #7257	http://sf-day.org/


Reply to: