commit: cc793fb5f0d7c39c904f9e209b804d8f762a96cd
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jul 23 16:05:51 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 26 10:22:40 2024 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cc793fb5
Check whether xtrace is enabled sensibly
To write [[ ${-/x/} != $- ]] is horribly backwards and comparatively
expensive. Implement the test - and its inverse - in a sensible fashion.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/ebuild.sh | 4 ++--
bin/install-qa-check.d/90cython-dep | 2 +-
bin/install-qa-check.d/90gcc-warnings | 2 +-
bin/phase-functions.sh | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 8b1e0861a8..a742397db9 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -473,7 +473,7 @@ __try_source() {
if [[ -r ${1} && -f ${1} ]]; then
local debug_on=false
- if [[ "${PORTAGE_DEBUG}" == "1" ]] && [[ "${-/x/}" == "$-" ]];
then
+ if [[ ${PORTAGE_DEBUG} == 1 ]] && [[ $- != *x* ]]; then
debug_on=true
fi
@@ -628,7 +628,7 @@ if ! has "${EBUILD_PHASE}" clean cleanrm ; then
unset E_RESTRICT PROVIDES_EXCLUDE REQUIRES_EXCLUDE
unset PORTAGE_EXPLICIT_INHERIT
- if [[ ${PORTAGE_DEBUG} != 1 || ${-/x/} != $- ]] ; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]] ; then
source "${EBUILD}" || die "error sourcing ebuild"
else
set -x
diff --git a/bin/install-qa-check.d/90cython-dep
b/bin/install-qa-check.d/90cython-dep
index 4932c02429..2458074c39 100644
--- a/bin/install-qa-check.d/90cython-dep
+++ b/bin/install-qa-check.d/90cython-dep
@@ -13,7 +13,7 @@ cython_dep_check() {
# In debug mode, the grep calls will produce false positives
# if they're shown in the trace.
local reset_debug=0
- if [[ ${-/x/} != $- ]] ; then
+ if [[ $- == *x* ]] ; then
set +x
reset_debug=1
fi
diff --git a/bin/install-qa-check.d/90gcc-warnings
b/bin/install-qa-check.d/90gcc-warnings
index 1060618dfa..2e728268e1 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -10,7 +10,7 @@ gcc_warn_check() {
# In debug mode, this variable definition and corresponding
grep calls
# will produce false positives if they're shown in the trace.
local reset_debug=0
- if [[ ${-/x/} != $- ]] ; then
+ if [[ $- == *x* ]] ; then
set +x
reset_debug=1
fi
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d037cf6776..2c3f2d389f 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -1002,7 +1002,7 @@ __ebuild_main() {
ewarn "pkg_${1}() is not defined: '${EBUILD##*/}'"
fi
export SANDBOX_ON="0"
- if [[ "${PORTAGE_DEBUG}" != "1" || "${-/x/}" != "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]]; then
__ebuild_phase_with_hooks pkg_${1}
else
set -x
@@ -1069,7 +1069,7 @@ __ebuild_main() {
;;
esac
- if [[ "${PORTAGE_DEBUG}" != "1" || "${-/x/}" != "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]]; then
__dyn_${1}
else
set -x
@@ -1083,7 +1083,7 @@ __ebuild_main() {
# for example, awking and piping a file in /tmp requires a temp
file to be created
# in /etc. If pkg_setup is in the sandbox, both our lilo and
apache ebuilds break.
export SANDBOX_ON="0"
- if [[ "${PORTAGE_DEBUG}" != "1" || "${-/x/}" != "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]]; then
__dyn_${1}
else
set -x