bug-hurd
[Top][All Lists]
Advanced

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

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


From: Justus Winter
Subject: Re: [PATCH 1/2] utils: escape arguments in fakeroot.sh
Date: Sun, 25 Aug 2013 18:08:22 +0200
User-agent: alot/0.3.4

Quoting Ivan Shmakov (2013-08-25 17:55:39)
> >>>>> Justus Winter <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]