[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] utils: escape arguments in fakeroot.sh
From: |
Ivan Shmakov |
Subject: |
Re: [PATCH 1/2] utils: escape arguments in fakeroot.sh |
Date: |
Sun, 25 Aug 2013 15:55:39 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
>>>>> 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/