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
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Eric Belanger (Snowman)
Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

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
Comment by Eric Belanger (Snowman) - Wednesday, 09 February 2011, 22:59 GMT
I believe this bug is valid. The bash package shouldn't have any reference to /etc/bash_completion as the bash-completion package takes care of that. This might be the cause of strange problems with bash-completion (see  FS#22807 ).
Comment by Eric Belanger (Snowman) - Wednesday, 09 February 2011, 23:03 GMT
In case the sourcing of /etc/bash_completion should be done in the bash package,
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
Comment by Allan McRae (Allan) - Wednesday, 09 February 2011, 23:09 GMT
That is a bash completion bug. It should not be sourced by /etc/profile at all as that is not a bash specific file. The /etc/profile.d/bash_completion.sh should be removed.

The sourcing in /etc/bash.bashrc is fine as is only sourced once and only when run interactively.
Comment by Eric Belanger (Snowman) - Wednesday, 09 February 2011, 23:55 GMT
OK. I'll remove /etc/profile.d/bash_completion.sh from bash-completion then.

Loading...