Quoting Ivan Shmakov (2013-08-25 17:55:39) > >>>>> Justus Winter <4win...@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 "$@"' \
Yes, obviously something like this ("$@") was among the first things I tried, but I couldn't get it to work, hence the building of the string with the manual '-escaping. > dummy.sh "$(pwd)" "$@" \ ? > -- / /hurd/fakeroot > > (Also to note is that `pwd` may generally contain whitespace > characters, and thus should be double-quoted, too.) Good point. Justus