On a system running Debian 5.0 (Lenny), running /etc/bash_completion
once sets some variables (e.g. BASH_COMPLETION) and then makes them
read-only. Running /etc/bash_completion again raises errors when it
tries to reset these read-only variables, and the script bails, taking
down all subsequent .bashrc processing with it. Work around this
problem by only sourcing /etc/bash_completion if the BASH_COMPLETION
variable is empty.
Later versions of /etc/bash_completion avoid this issue by only
setting the variables if they are empty.
Versions affected:
Debian 5.0 (Lenny) running /etc/bash_completion
20060301
Ubuntu 8.04.4 running /etc/bash_completion
20060301
Versions not affected:
Ubuntu 9.04 running /etc/bash_completion
20080617.5
Ubuntu 10.04.2 running /etc/bash_completion 1.1 (2009)
Ubuntu 10.04.3 running /etc/bash_completion 1.1 (2009)
The fix should work with all the versions I've seen.
# /etc/bash_completion
# You won't need to enable this if you uncommented the appropriate
# section in /etc/bash.bashrc.
- if [ -f /etc/bash_completion ]; then
+ if [ -f /etc/bash_completion ] && [ -z "${BASH_COMPLETION}" ]; then
. /etc/bash_completion
fi
fi