FS#11195 - [bash-completion] needs more love
Attached to Project:
Arch Linux
Opened by Xavier (shining) - Tuesday, 12 August 2008, 08:49 GMT
Last edited by Andrea Scarpino (BaSh) - Friday, 09 October 2009, 12:30 GMT
Opened by Xavier (shining) - Tuesday, 12 August 2008, 08:49 GMT
Last edited by Andrea Scarpino (BaSh) - Friday, 09 October 2009, 12:30 GMT
|
Details
Description:
The bash-completion package is apparently newer in the old cvs repo than in the new svn repo. http://repos.archlinux.org/viewvc.cgi/extra/system/bash-completion/?root=extra http://repos.archlinux.org/viewvc.cgi/bash-completion/repos/extra-i686/ Any chances the changes could be merged? In CVS, all the unused and old files were removed, and the bash_completion.sh is much cleaner. Also using $PS1 for detecting interactive shell is not the best way and can break in some cases. here is a better one : http://defindit.com/readme_files/bash_examples.html "Using shopt -q login_shell seems to be the modern and reliable way to detect interactive shell sessions." So attaching a new bash_completion.sh for reflecting that change |
This task depends upon
Also I didn't know against which version I should diff, the newer cvs one or the older svn one.
http://repos.archlinux.org/viewvc.cgi/extra/system/bash-completion/bash_completion.sh?root=extra&r1=1.6&r2=1.7
So I just based the diff against the svn version, and included the "remove unnecessary bash version checking" change.
Besides the shopt -q login_shell change, I made a second one too :
http://bbs.archlinux.org/viewtopic.php?pid=405760#p405760
It seems better to use $BASH_VERSION rather than $SHELL for checking that the shell is bash.
And the upstream script does it that way.
It can be worked around by making each terminal run a login shell.
A better alternative might be to kill this bash_completion.sh script altogether, and stop worrying about it.
We could optionally add a scriptlet telling the user how to enable it : echo "source /etc/bash_completion" >> ~/.bashrc
What is wrong with PS1 method? Maybe there is another method, that wouldn't break all Gnome and KDE installations while fixing "some cases"? ;)
isn't /etc/profile.d/bash_completion.sh only read when /etc/profile is sourced anyway ? And isn't /etc/profile only source in logging shells ?
So I guess this /etc/profile.d/bash_completion.sh is just useless and needs to be removed.
I also already wrote my opinion about this :
--------------
A better alternative might be to kill this bash_completion.sh script altogether, and stop worrying about it.
We could optionally add a scriptlet telling the user how to enable it : echo "source /etc/bash_completion" >> ~/.bashrc"
--------------
and it is also how the upstream page (http://bash-completion.alioth.debian.org/) says to enable it :
append the following to /etc/bashrc or ~/.bashrc :
--------------
you need to source it from either /etc/bashrc or ~/.bashrc. If you have bash >= 2.04, you just do it with:
# Use bash-completion, if available
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
--------------
http://wiki.archlinux.org/index.php?title=Bash&diff=75274&oldid=69317
That seems to be true.
> And isn't /etc/profile only source in logging shells ?
That seems not to be true. In any case, reverting to the old $PS1-based test results in my non-login shells sourcing bash_completion.sh without its needing to be in my ~/.bashrc.
Eliminating the /etc/profile sourcing is no great hardship. It's just confusing that it should be there but be implemented in a way that ignores many terminal setups.
I will revamp this soon
/etc/bash.bashrc just sources /etc/bash_completion
and in the future (
FS#16346), /etc/profile.bash will source /etc/bash.bashrcso all bases will be covered, in a more elegant way (imo).