Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2019 20:56:45 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352821 - head/tools/tools/nanobsd
Message-ID:  <201909272056.x8RKujGY006853@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Sep 27 20:56:44 2019
New Revision: 352821
URL: https://svnweb.freebsd.org/changeset/base/352821

Log:
  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.

Modified:
  head/tools/tools/nanobsd/defaults.sh

Modified: head/tools/tools/nanobsd/defaults.sh
==============================================================================
--- head/tools/tools/nanobsd/defaults.sh	Fri Sep 27 20:56:31 2019	(r352820)
+++ head/tools/tools/nanobsd/defaults.sh	Fri Sep 27 20:56:44 2019	(r352821)
@@ -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
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909272056.x8RKujGY006853>