commit:     c6ee01faaeabcab22b29e8d3f671ba6fd7d00724
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  8 06:19:02 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Jul  8 06:19:02 2023 +0000
URL:        https://gitweb.gentoo.org/proj/eselect.git/commit/?id=c6ee01fa

Avoid subshell on startup

* bin/eselect.in (PATH): Avoid subshell.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ChangeLog      | 4 ++++
 bin/eselect.in | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 65a49f0..932edc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2023-07-08  Ulrich Müller  <[email protected]>
+
+       * bin/eselect.in (PATH): Avoid subshell.
+
 2023-06-12  Ulrich Müller  <[email protected]>
 
        * configure.ac: Update version to 1.4.25.

diff --git a/bin/eselect.in b/bin/eselect.in
index 36581e1..ee26b80 100755
--- a/bin/eselect.in
+++ b/bin/eselect.in
@@ -62,7 +62,8 @@ umask +rx
 # Sanitise PATH: We don't want to execute Portage's internal helpers
 # if we're called from an ebuild.
 IFS=:
-read -r -d '' -a path < <(printf '%s\0' "${PATH}")
+# Append ${IFS} to prevent any trailing empty field from being dropped
+set -f; path=(${PATH}${IFS}); set +f
 for i in "${!path[@]}"; do
        [[ ${path[i]} == */portage?(/*)/ebuild-helpers?(/*) ]] && unset 
"path[i]"
 done

Reply via email to