Prevent root PATH expansion proliferating

The PATH expansion done in `_root_command()':

    PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3

stayed effective with bash >= 4.1.4 running in posix mode, causing PATH to grow
ever larger when doing sudo completions.  This is now fixed.

To run the automated test:

    ./run ./completion/sudo.exp

See also:
- http://www.mail-archive.com/bug-bash@gnu.org/msg06942.html
- bash patch: bash41-004
master
Freddy Vulto 2010-05-26 22:57:08 +02:00
parent 9db025c708
commit 876c8e26c1
1 changed files with 2 additions and 1 deletions

View File

@ -1729,7 +1729,8 @@ complete -F _command -o filenames nohup exec nice eval time ltrace then \
_root_command()
{
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
_command $1 $2 $3
}
complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo