Package: bash Version: 3.0-16 Severity: normal
In /etc/bash_completion, _root_command and _command do not protect themself against empty argument, so arguments can be shifted if, for example, the second is empty and not the third. To see the problem, one can install the mercurial package. Then, try to type : * "hg " and [tab] [tab]. You get the list of hg subcommands (because bash calls "_hg hg '' hg") * "sudo hg " and [tab] [tab]. You get the list of files in current directory. (because bash calls _root_command that calls _command that calls "_hg hg hg" (note the missing second empty argument)) Here is a patch that solve this bug. Best, Vincent -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.12-1-686 Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Versions of packages bash depends on: ii base-files 3.1.7 Debian base system miscellaneous f ii libc6 2.3.5-6 GNU C Library: Shared libraries an ii libncurses5 5.4-9 Shared libraries for terminal hand ii passwd 1:4.0.12-1 change and administer password and bash recommends no packages. -- no debconf information
--- bash_completion.orig 2005-09-19 23:47:39.000000000 +0200 +++ bash_completion.new 2005-09-19 23:37:12.000000000 +0200 @@ -3109,10 +3109,10 @@ COMP_CWORD=$(( $COMP_CWORD > 0 ? $COMP_CWORD : 1 )) cur=${COMP_WORDS[COMP_CWORD]} _COMMAND_FUNC=$func - _COMMAND_FUNC_ARGS=( $cmd $2 $3 ) + _COMMAND_FUNC_ARGS=( $cmd "$2" $3 ) COMP_LINE=$cline COMP_POINT=$(( ${COMP_POINT} - ${#1} - 1 )) - $func $cmd $2 $3 + $func $cmd "$2" $3 # remove any \: generated by a command that doesn't # default to filenames or dirnames (e.g. sudo chown) if [ "${cspec#*-o }" != "$cspec" ]; then @@ -3136,7 +3136,7 @@ _root_command() { - PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3 + PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command "$1" "$2" "$3" } complete -F _root_command $filenames sudo fakeroot really