diff --git a/packages/b/bash/files/profile/10-path.sh b/packages/b/bash/files/profile/10-path.sh
index e17981d6761..6672cdaae26 100644
--- a/packages/b/bash/files/profile/10-path.sh
+++ b/packages/b/bash/files/profile/10-path.sh
@@ -1,20 +1,64 @@
# Begin /usr/share/defaults/etc/profile.d/10-path.sh
-export PATH="/usr/sbin:/usr/bin"
-if [ -d "/usr/local/sbin" ]; then
- export PATH="$PATH:/usr/local/sbin"
-fi
+PREFIX_PATH=
+POSTFIX_PATH=
-if [ -d "/usr/local/bin" ]; then
- export PATH="$PATH:/usr/local/bin"
-fi
+# PATH exists, only append missing stuff to it
+if [[ -n "${PATH}" ]]; then
-if [ -d "$HOME/bin" ]; then
- export PATH="$HOME/bin:$PATH"
-fi
+ echo "DEBUG: Starting \$PATH: ${PATH}"
+
+ for d in "/usr/sbin" "/usr/bin" "/usr/local/sbin" "/usr/local/bin"; do
+ # respect user path ordering if the element is already in $PATH
+ if [[ "${PATH}" =~ "${d}" ]]; then
+ :
+ echo "DEBUG: Skipping ${d} as it is already in \$PATH"
+ else
+ POSTFIX_PATH="${POSTFIX_PATH}:${d}"
+ echo "DEBUG: Added ${d} to \$POSTFIX_PATH, \$POSTFIX_PATH is now: ${POSTFIX_PATH}"
+ fi
+ done
+
+ for d in "${HOME}/.local/bin" "${HOME}/bin"; do
+ # respect user path ordering if the element is already in $PATH
+ if [[ "${PATH}" =~ "${d}" ]]; then
+ :
+ echo "DEBUG: Skipping ${d} as it is already in \$PATH"
+ else
+ PREFIX_PATH="${d}:${PREFIX_PATH}"
+ echo "DEBUG: Added ${d} to \$PREFIX_PATH, \$PREFIX_PATH is now: ${PREFIX_PATH}"
+ fi
+ done
+
+ # this should adequately respect existing path definitions
+ PATH="${PREFIX_PATH}${PATH}${POSTFIX_PATH}"
+
+else
+# PATH does NOT exist, build it from scratch.
-if [ -d "$HOME/.local/bin" ]; then
- export PATH="$HOME/.local/bin:$PATH"
+ echo "DEBUG: \$PATH is empty, building a default \$PATH ..."
+
+ DEFAULT_PATH="/usr/sbin:/usr/bin"
+ if [[ -d "/usr/local/sbin" ]]; then
+ DEFAULT_PATH="${DEFAULT_PATH}:/usr/local/sbin"
+ fi
+
+ if [[ -d "/usr/local/bin" ]]; then
+ DEFAULT_PATH="${DEFAULT_PATH}:/usr/local/bin"
+ fi
+
+ if [[ -d "$HOME/bin" ]]; then
+ DEFAULT_PATH="${HOME}/bin:${DEFAULT_PATH}"
+ fi
+
+ if [[ -d "$HOME/.local/bin" ]]; then
+ DEFAULT_PATH="${HOME}/.local/bin:${DEFAULT_PATH}"
+ fi
+
+ PATH="${DEFAULT_PATH}"
fi
+export PATH="${PATH}"
+echo "DEBUG: \$PATH is now: ${PATH}"
+
# End /usr/share/defaults/etc/profile.d/10-path.sh
diff --git a/packages/b/bash/package.yml b/packages/b/bash/package.yml
index ece6fc6bc33..7677d80bb63 100644
--- a/packages/b/bash/package.yml
+++ b/packages/b/bash/package.yml
@@ -1,6 +1,6 @@
name : bash
version : 5.2.26
-release : 80
+release : 81
source :
- https://ftp.gnu.org/gnu/bash/bash-5.2.21.tar.gz : c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8
license :
diff --git a/packages/b/bash/pspec_x86_64.xml b/packages/b/bash/pspec_x86_64.xml
index dfc68d71bed..bf9b1e7f7c6 100644
--- a/packages/b/bash/pspec_x86_64.xml
+++ b/packages/b/bash/pspec_x86_64.xml
@@ -3,8 +3,8 @@
bash
https://www.gnu.org/software/bash
- Troy Harvey
- harveydevel@gmail.com
+ Rune Morling
+ ermo@serpentos.com
GPL-3.0-or-later
system.base
@@ -133,7 +133,7 @@
programming.devel
- bash
+ bash
/usr/include/bash/alias.h
@@ -199,12 +199,12 @@
-
+
2024-06-25
5.2.26
Packaging update
- Troy Harvey
- harveydevel@gmail.com
+ Rune Morling
+ ermo@serpentos.com
\ No newline at end of file