Package: bash
Version: 4.4.18-3.1
Severity: normal
Tags: patch
Dear Maintainer,
On a fresh install, special handling of $HOME/bin is located in .profile
and not in .bashrc. Therefore, interactive login shells get the additional
path but interactive non-login shells do not.
What is expected is that the PATH variable is the same for either login
shell and for non-login shell. To verify the current difference on a
Debian system with Xorg installed and $HOME/bin created, press Ctrl-Alt-F1
and login to the console, then enter 'echo $PATH'. Then press F7 to return
to X and open a terminal of choice and enter the same, 'echo $PATH'. You
will observe the X non-login shell PATH variable does not contain
$HOME/bin.
The simplest solution is to move the special handling of $HOME/bin from
.profile to .bashrc. This is in fact similarly handled in the original
bash source (version 4.4) example/startup-files/Bashrc.bfox and
example/startup-files/Bash_profile.
This bug is closely related to #581765 and #847399 and may resolve them.
It is distantly related to #606369.
A patch was created by extracting the deb package to orig, copying orig to
new, modifying new then running:
diff -ruN orig/ new/ > bash_4.4.18-3.1_home_bin.patch
I am unfamiliar with normal Debian patching and apologize in advance if
the patch is worthless.
Also note that an oddity I observed is that special handling of
$HOME/.local/bin was not performed in .profile as installed, but
is provided for in the package etc/skel/.profile.
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 4.17.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages bash depends on:
ii base-files 10.1
ii debianutils 4.8.6
ii libc6 2.27-5
ii libtinfo6 6.1+20180714-1
Versions of packages bash recommends:
ii bash-completion 1:2.8-1
Versions of packages bash suggests:
pn bash-doc <none>
-- no debconf information
*** /mnt/bash_4.4.18-3.1_home_bin.patch
diff -ruN orig/etc/skel/.bashrc new/etc/skel/.bashrc
--- orig/etc/skel/.bashrc 2018-06-17 15:15:06.000000000 -0400
+++ new/etc/skel/.bashrc 2018-07-29 10:03:51.021356425 -0400
@@ -111,3 +111,13 @@
. /etc/bash_completion
fi
fi
+
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/bin" ] ; then
+ PATH="$HOME/bin:$PATH"
+fi
+
+# set PATH so it includes user's private bin if it exists
+if [ -d "$HOME/.local/bin" ] ; then
+ PATH="$HOME/.local/bin:$PATH"
+fi
diff -ruN orig/etc/skel/.profile new/etc/skel/.profile
--- orig/etc/skel/.profile 2018-06-17 15:15:06.000000000 -0400
+++ new/etc/skel/.profile 2018-07-29 10:05:28.571089091 -0400
@@ -15,13 +15,3 @@
. "$HOME/.bashrc"
fi
fi
-
-# set PATH so it includes user's private bin if it exists
-if [ -d "$HOME/bin" ] ; then
- PATH="$HOME/bin:$PATH"
-fi
-
-# set PATH so it includes user's private bin if it exists
-if [ -d "$HOME/.local/bin" ] ; then
- PATH="$HOME/.local/bin:$PATH"
-fi