[arch-projects] [devtools] [PATCH 1/2] common: fix arg concatenation and unreachable statement
We run from a non-interactive shell, so the exec which is inevitably called will replace the current process and 'die' will never run under any circumstances. Also fix a bug with the su fallback which would cause multiple arguments to be concatenated without any whitespace between them. --- lib/common.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index b885080..e4bb91f 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -236,8 +236,9 @@ check_root() { (( EUID == 0 )) && return if type -P sudo >/dev/null; then exec sudo -- "$@" + elif type -P su >/dev/null; then + exec su root -c "$(printf ' %q' "$@")" else - exec su root -c "$(printf '%q' "$@")" + die 'This script must be run as root.' fi - die 'This script must be run as root.' } -- 1.9.3
Fixes a breakage introduced in 6db31cc16a80442 which leads to errors being masked from makechrootpkg. https://bugs.archlinux.org/task/40620 --- lib/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/common.sh b/lib/common.sh index e4bb91f..d9d7676 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -79,8 +79,9 @@ trap_abort() { } trap_exit() { + local r=$? trap - EXIT INT QUIT TERM HUP - cleanup + cleanup $r } die() { -- 1.9.3
I submitted a patch for this two weeks ago https://mailman.archlinux.org/pipermail/arch-projects/2014-May/004158.html On Sun, Jun 1, 2014 at 9:16 PM, Dave Reisner <dreisner@archlinux.org> wrote:
Fixes a breakage introduced in 6db31cc16a80442 which leads to errors being masked from makechrootpkg.
https://bugs.archlinux.org/task/40620 --- lib/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/common.sh b/lib/common.sh index e4bb91f..d9d7676 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -79,8 +79,9 @@ trap_abort() { }
trap_exit() { + local r=$? trap - EXIT INT QUIT TERM HUP - cleanup + cleanup $r }
die() { -- 1.9.3
participants (2)
-
Dave Reisner
-
Joel Teichroeb