/root/.bashrc might be invoked without /usr/bin in PATH
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
Triaged
|
Low
|
Unassigned |
Bug Description
Binary package hint: bash
When you are dropped into a single-user root shell, such as when fsck has failed during boot, the shell runs with a minimal PATH which does not include /usr/bin
Yet, there are commands from /usr/bin which are being invoked from /root/.bashrc
The code has a check for the case when /usr is not mounted; but this is not sufficient. It should either use the full path when it actually invokes a command in /usr/bin, or not run these commands when /usr is not mounted. (I would somehow prefer the latter, as they are generally "sugar candy" which is not directly useful in a root shell / rescue disk scenario.)
vnix$ PATH=/sbin:
vnix$ vnix$ lesspipe
Command 'lesspipe' is available in '/usr/bin/lesspipe'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
bash: lesspipe: command not found
vnix$ fgrep lesspipe /root/.bashrc
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
vnix$ ls -l /usr/bin/lesspipe
-rwxr-xr-x 1 root root 6507 2007-07-20 14:36 /usr/bin/lesspipe
vnix$ [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
bash: lesspipe: command not found
bash: Command: command not found
bash: The: command not found
vnix$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
This is also tangentially related to bug #121992
Changed in bash: | |
importance: | Undecided → Low |
status: | New → Confirmed |
Changed in bash: | |
status: | Confirmed → Triaged |
Another option would be to make sure /usr/bin is in the PATH if it is mounted; perhaps that would be the simplest fix.