Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#15456 - [bash-completion] profile.d/bash_completion.sh doesn't work well
Attached to Project:
Arch Linux
Opened by Peter Simons (peti) - Thursday, 09 July 2009, 09:11 GMT
Last edited by Aaron Griffin (phrakture) - Tuesday, 22 September 2009, 22:26 GMT
Opened by Peter Simons (peti) - Thursday, 09 July 2009, 09:11 GMT
Last edited by Aaron Griffin (phrakture) - Tuesday, 22 September 2009, 22:26 GMT
|
DetailsWithout the following patch, bash-completion will not be enabled in normal interactive shells, i.e. a shell that's interactive but not a login shell:
--- a/profile.d/bash_completion.sh +++ b/profile.d/bash_completion.sh @@ -3,7 +3,7 @@ [ -z "$BASH_VERSION" -o -n "$BASH_COMPLETION" ] && return # Check for interactive shell. -if shopt -q login_shell; then +if [ -n "$PS1" ]; then if [ -r /etc/bash_completion ]; then # Source completion code. . /etc/bash_completion |
This task depends upon
Closed by Aaron Griffin (phrakture)
Tuesday, 22 September 2009, 22:26 GMT
Reason for closing: Implemented
Additional comments about closing: After much jumping through hoops - both login shells and non-login shells will source bash_completion if available
Tuesday, 22 September 2009, 22:26 GMT
Reason for closing: Implemented
Additional comments about closing: After much jumping through hoops - both login shells and non-login shells will source bash_completion if available
I use KDM to login, then use yakuake. It apparently is not a login shell.
What is the login shell then?
Anyway, personally, I feel that profile.d/* should test for an interactive shell rather than a login shell. I realize, however, that it can be argued for the other way round just the same. It's probably a matter of personal preference.
Here is a attempt to explain this:
Apparently, connecting to a window manager is considered as a login into a "root" shell (such as the tty* prompts available via Ctrl+Alt+F*). This means "shopt login_shell" is on and thus /etc/profile and his family are sourced. However these "login" scripts are here to define environment stuff that can be inherit by non login "children" shell (eg Konsole, xterm, etc), such as environment variables. bash_completion does not define inheritable stuff (I think) but only change the parameters of the current bash instance (which is lost when launching a children shell). That's why it is useless to put the script in profile.d/*.sh
The right behavior should be to put the call to bash_completion in /etc/bash.bashrc (which seems to not exist in my fresh arch install but is normally sourced in non login shell) and to test the interactivity by another mean (maybe by the patch suggested in this bug report).
If we chose that path, however, we need a mechanism to make /etc/bashrc easily extendable by other packages, too, i.e. an /etc/bashrc.d/* directory. This might be the right thing to do, but it does add some complexity. Also, there might be other shells that *do* understand bash completion syntax (zsh, maybe? I hear it can do pretty much anything), and those shells might source /etc/profile but not /etc/bashrc.
How else am I going to get all those variables that are added by scripts in this directory, for java, firefox, alsa, locale, Qt3, wine...
Otherwise I would have to add everything to my .bashrc file, and manage those settings while applications are installed and removed.
b) @sjakub: That is the way Unix has always worked. You have one login shell that sets up all the environment, and this can spawn off multiple non-login shells that inherit that environment. If shells are not launched from a parent login shell, then they SHOULD be login shells.
If we allow /etc/profile to be run by non-login shells, we effectively remove any difference or choice for all users. That is wrong.
The latest bash in the repos has a /etc/bash.bashrc that loads bash_completion
xterm*loginShell: true
Rxvt*loginShell: true
For konsole you have to change the profile. The default command is: /bin/bash, change it to "/bin/bash -l"
In gnome-terminal you have the option to run a command as a login shell.
In other words, you have to configure every program for which you want a login shell.
And then, there's this comment near the top of /etc/bash.bashrc:
> # When running a non-login shell, apply the following settings
I'm not sure what to do to have bash-completion working on a login shell. Any advice would be appreciated.
Sigh... so that means I should put this script back, and this bug becomes a no-op.
This means the two are mutually exclusive and duplicate functionality. Sigh