/root/.bashrc might be invoked without /usr/bin in PATH

Bug #212413 reported by era
2
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:/bin:/usr/games

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_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"

This is also tangentially related to bug #121992

Revision history for this message
era (era) wrote :

Another option would be to make sure /usr/bin is in the PATH if it is mounted; perhaps that would be the simplest fix.

Revision history for this message
era (era) wrote :

Just to keep this reasonably self-contained, bug #121992 is about dircolors, so that in addition to lesspipe should be fixed (at least).

Matthias Klose (doko)
Changed in bash:
importance: Undecided → Low
status: New → Confirmed
Mika Fischer (zoop)
Changed in bash:
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.