[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 03/70: utils: escape arguments in fakeroot.sh
From: |
Samuel Thibault |
Subject: |
[hurd] 03/70: utils: escape arguments in fakeroot.sh |
Date: |
Mon, 16 Sep 2013 07:41:34 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 7755215040bca03ac929dfd67fdf2c7dbd2068ea
Author: Justus Winter <address@hidden>
Date: Fri Aug 23 10:09:34 2013 +0200
utils: escape arguments in fakeroot.sh
fakeroot.sh uses /bin/sh to first change the working directory and
then execute the given program in the fakeroot context. But the
arguments given on the command line were not properly escaped:
% '/bin/sh' '-c' 'echo $0'
/bin/sh
% fakeroot-tcp '/bin/sh' '-c' 'echo $0'
/bin/sh
% fakeroot-hurd '/bin/sh' '-c' 'echo $0'
<empty line>
% fakeroot-hurd-fixed '/bin/sh' '-c' 'echo $0'
/bin/sh
* utils/fakeroot.sh: Escape arguments handed to /bin/sh so that they
are not evaluated prematurely.
---
utils/fakeroot.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/utils/fakeroot.sh b/utils/fakeroot.sh
index 1ace1cf..a64e963 100644
--- a/utils/fakeroot.sh
+++ b/utils/fakeroot.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Execute a command in an environment where it appears to be root.
#
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2013 Free Software Foundation, Inc.
#
# This file is part of the GNU Hurd.
#
@@ -54,10 +54,16 @@ if [ $# -eq 0 ]; then
set -- ${SHELL:-/bin/sh}
fi
+TARGET=
+until [ $# -eq 0 ]; do
+ TARGET="${TARGET} '$(echo "$1" | sed -e "s/'/'\\\\''/g")'"
+ shift
+done
+
# We exec settrans, which execs the "fakeauth" command in the chroot context.
# The `pwd` is evaluated here and now, and that result interpreted inside
# the shell running under fakeauth to chdir there inside the chroot world.
# That shell then execs our arguments as a command line.
exec /bin/settrans --chroot \
- /bin/fakeauth /bin/sh -c "cd `pwd`; $*" \
+ /bin/fakeauth /bin/sh -c "cd `pwd`; exec ${TARGET}" \
-- / /hurd/fakeroot
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (de8b182 -> b2f8745), Samuel Thibault, 2013/09/16
- [hurd] 03/70: utils: escape arguments in fakeroot.sh,
Samuel Thibault <=
- [hurd] 17/70: console-client: add daemonizing support, Samuel Thibault, 2013/09/16
- [hurd] 21/70: utils: add nullauth utility, Samuel Thibault, 2013/09/16
- [hurd] 22/70: Disable transparent gzip/bzip2 decompression, Samuel Thibault, 2013/09/16
- [hurd] 19/70: trans: drop privileges in the null translator, Samuel Thibault, 2013/09/16
- [hurd] 35/70: proc: add proc_mark_important server code, Samuel Thibault, 2013/09/16
- [hurd] 20/70: tmpfs: drop privileges in the tmpfs translator, Samuel Thibault, 2013/09/16
- [hurd] 27/70: daemons: fix setsid(2) in console-run, Samuel Thibault, 2013/09/16
- [hurd] 14/70: Optimize translator string copy, Samuel Thibault, 2013/09/16
- [hurd] 13/70: libnetfs: properly respond to file_get_translator requests, Samuel Thibault, 2013/09/16
- [hurd] 23/70: Do not build gzip/bzip2 support, Samuel Thibault, 2013/09/16