summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2018-06-12 13:28:51 +0200
committerAllan McRae <allan@archlinux.org>2018-08-10 07:20:40 +0200
commit2d8d8af915d352b61178a981603360c27a3899f2 (patch)
tree70ea242e0c91924fb6cd7fcb6e0987cb0f3413fb
parent7d05ffceaf9161a6572505d25b5017e1eb33bf0e (diff)
downloadpacman-2d8d8af915d352b61178a981603360c27a3899f2.tar.gz
pacman-2d8d8af915d352b61178a981603360c27a3899f2.tar.xz
scripts: pass on options such as set -x to child processes
When re-running makepkg for fakeroot, if `bash -x makepkg` was used this is lost. Fix by encoding the current set of options explicitly in the invocation, both for makepkg and for the wrapper used to test scripts inside the source tree. Also change to use ${BASH_SOURCE[0]} instead of $0 as the latter can be anything the parent process wants, while the former is explicitly set by bash itself to the filepath of the script. See http://mywiki.wooledge.org/BashFAQ/028 Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in2
-rw-r--r--scripts/wrapper.sh.in2
2 files changed, 2 insertions, 2 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2ac1bbca..39983fcd 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -181,7 +181,7 @@ clean_up() {
enter_fakeroot() {
msg "$(gettext "Entering %s environment...")" "fakeroot"
- fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
+ fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
}
# Automatically update pkgver variable if a pkgver() function is provided
diff --git a/scripts/wrapper.sh.in b/scripts/wrapper.sh.in
index 94c7e0ed..f9480ea4 100644
--- a/scripts/wrapper.sh.in
+++ b/scripts/wrapper.sh.in
@@ -20,4 +20,4 @@
DIR="@PWD@"
-LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/@PROGNAME@ "$@"
+LIBRARY="$DIR"/libmakepkg exec bash -$- "$DIR"/.lib/@PROGNAME@ "$@"