From 80344cb8d5e8c74e5e84d96f01f0bd5d3bfb316d Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 8 Dec 2024 13:11:59 +0100 Subject: [PATCH 1/2] various: fix "list contains" check Testing for the presence of an item in a space separated list with this pattern needs to pad the list with spaces at the beginning and end. Otherwise the first and last element will never be matched. Resolves #354220 --- pkgs/applications/editors/emacs/build-support/wrapper.nix | 2 +- .../qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch | 6 +++--- pkgs/stdenv/generic/setup.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/wrapper.nix b/pkgs/applications/editors/emacs/build-support/wrapper.nix index 5b325f5e0a9e..409b3519f258 100644 --- a/pkgs/applications/editors/emacs/build-support/wrapper.nix +++ b/pkgs/applications/editors/emacs/build-support/wrapper.nix @@ -75,7 +75,7 @@ runCommand # well :D. local varSlice="$var[*]" # ''${..-} to hack around old bash empty array problem - case "''${!varSlice-}" in + case " ''${!varSlice-} " in *" $pkg "*) return 0 ;; esac unset -v varSlice diff --git a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch index dc1d1e2083c0..7f2a4daab565 100644 --- a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch +++ b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch @@ -108,7 +108,7 @@ index fc498985e..b5d204d0d 100755 if [ $ERRORS -ne 0 ]; then - FAILURES_FILES="${FAILURES_FILES} ${_TESTNAME}\n" - ((FAILURES+=$ERRORS)) -+ if [[ $ERROR_EXCEPTIONS == *" $_TESTNAME "* ]]; then ++ if [[ " $ERROR_EXCEPTIONS " == *" $_TESTNAME "* ]]; then + EXCEPTED_FAILURES_FILES="${EXCEPTED_FAILURES_FILES} ${_TESTNAME}\n" + ((EXCEPTED_FAILURES+=$ERRORS)) + else @@ -117,7 +117,7 @@ index fc498985e..b5d204d0d 100755 + fi elif [ $WARNINGS -ne 0 ]; then - if [[ $EXCEPTIONS == *$_TESTNAME* ]]; then -+ if [[ $EXCEPTIONS == *" $_TESTNAME "* ]]; then ++ if [[ " $EXCEPTIONS " == *" $_TESTNAME "* ]]; then EXCEPTED_FILES="${EXCEPTED_FILES} ${_TESTNAME}\n" ((EXCEPTED+=$WARNINGS)) else @@ -125,7 +125,7 @@ index fc498985e..b5d204d0d 100755 ((FATAL_WARNINGS+=$WARNINGS)) fi - elif [[ $EXCEPTIONS == *$_TESTNAME* ]]; then -+ elif [[ $ERROR_EXCEPTIONS == *" $_TESTNAME "* || $EXCEPTIONS == *" $_TESTNAME "* ]]; then ++ elif [[ " $ERROR_EXCEPTIONS " == *" $_TESTNAME "* || " $EXCEPTIONS " == *" $_TESTNAME "* ]]; then WOOT_FILES="${WOOT_FILES} ${_TESTNAME}\n" fi done diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 72fdbef981da..a3357822eacb 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -674,7 +674,7 @@ findInputs() { # shellcheck disable=SC1087 local varSlice="$var[*]" # ${..-} to hack around old bash empty array problem - case "${!varSlice-}" in + case " ${!varSlice-} " in *" $pkg "*) return 0 ;; esac unset -v varSlice From b5a7391298c2c2fecc47977aafad2a3598329b38 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 8 Dec 2024 16:34:29 +0100 Subject: [PATCH 2/2] tcl: simplify bash "list contains" check in setup hook --- pkgs/development/interpreters/tcl/tcl-package-hook.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/tcl/tcl-package-hook.sh b/pkgs/development/interpreters/tcl/tcl-package-hook.sh index 8548ac66402f..b1c89f8dacf2 100644 --- a/pkgs/development/interpreters/tcl/tcl-package-hook.sh +++ b/pkgs/development/interpreters/tcl/tcl-package-hook.sh @@ -23,7 +23,7 @@ _addToTclLibPath() { if [[ -z "${TCLLIBPATH-}" ]]; then export TCLLIBPATH="$tclPkg" else - if [[ "$TCLLIBPATH" != *"$tclPkg "* && "$TCLLIBPATH" != *"$tclPkg" ]]; then + if [[ "$TCLLIBPATH " != *"$tclPkg "* ]]; then export TCLLIBPATH="${TCLLIBPATH} $tclPkg" fi fi