aboutsummaryrefslogtreecommitdiff
path: root/tools/tools/nanobsd
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-09-27 20:56:44 +0000
committerWarner Losh <imp@FreeBSD.org>2019-09-27 20:56:44 +0000
commit04b9e9473db66623dfd89bfab329f96ddd897d1c (patch)
treeced413a77d555c9b6fa9e16b01720400c7dd44bf /tools/tools/nanobsd
parent067f74c267ba5acbbbb0f31f1c3778b000abbb30 (diff)
downloadsrc-04b9e9473db66623dfd89bfab329f96ddd897d1c.tar.gz
src-04b9e9473db66623dfd89bfab329f96ddd897d1c.zip
Push and pop xtrace correctly for run_early_customize
run_early_customize is run as a shell list, not as a subshell, so that the side effects of setting variables can affect later stages of the build (for better or worse, it's been like this since it was introduced). It therefore has the side effect of turning off xtrace always, which limits the usefulness of sh -x nanobsd.sh. Remember the old setting and only turn off tracing after the command if tracing was off before. All the other places where we do similar things we use a subshell, so we don't need to do this.
Notes
Notes: svn path=/head/; revision=352821
Diffstat (limited to 'tools/tools/nanobsd')
-rwxr-xr-xtools/tools/nanobsd/defaults.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 806b92453d37..65c717782eda 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -445,7 +445,11 @@ run_early_customize ( ) {
pprint 2 "early customize \"$c\""
pprint 3 "log: ${NANO_LOG}/_.early_cust.$c"
pprint 4 "`type $c`"
- { set -x ; $c ; set +x ; } >${NANO_LOG}/_.early_cust.$c 2>&1
+ { t=$(set -o | awk '$1 == "xtrace" && $2 == "off" { print "set +x"}');
+ set -x ;
+ $c ;
+ eval $t
+ } >${NANO_LOG}/_.early_cust.$c 2>&1
done
}