FS#22832 - bash: bash.bashrc has redundant sourcing of bash_completion
Attached to Project:
Arch Linux
Opened by MB (mrbougo) - Wednesday, 09 February 2011, 20:43 GMT
Last edited by Eric Belanger (Snowman) - Friday, 11 February 2011, 22:46 GMT
Opened by MB (mrbougo) - Wednesday, 09 February 2011, 20:43 GMT
Last edited by Eric Belanger (Snowman) - Friday, 11 February 2011, 22:46 GMT
|
Details
Description:
bash.bashrc should not source /etc/bash_completion as this is already taken care of by /etc/profile through a script in /etc/profile.d/ . Additional info: * bash-4.1.009-3 Steps to reproduce: Have bash_completion installed, and run env -i bash --login --verbose to start a login shell with a clean environment, notice that bash_completion is sourced twice, first from bash_completion.sh in /etc/profile.d and second from the line in bash.bashrc. |
This task depends upon
Closed by Eric Belanger (Snowman)
Friday, 11 February 2011, 22:46 GMT
Reason for closing: Fixed
Additional comments about closing: fixed in bash-completion-1.3-2
Friday, 11 February 2011, 22:46 GMT
Reason for closing: Fixed
Additional comments about closing: fixed in bash-completion-1.3-2
FS#22807).then it should do the tests currently done in /etc/profile.d/bash_completion.sh:
$ cat /etc/profile.d/bash_completion.sh
# Check for interactive bash and that we haven't already been sourced.
[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -gt 3 ] || [ $bmajor -eq 3 -a $bminor -ge 2 ]; then
if shopt -q progcomp && [ -r /etc/bash_completion ]; then
# Source completion code.
. /etc/bash_completion
fi
fi
unset bash bmajor bminor
The sourcing in /etc/bash.bashrc is fine as is only sourced once and only when run interactively.