#678174 bash-completion: /etc/profile.d/bash_completion.sh does not work for non-login shells (e.g., screen, xterm)

Package:
bash-completion
Source:
bash-completion
Submitter:
Matthijs Kooijman
Date:
2012-12-16 15:39:04 UTC
Severity:
minor
Blocked By:
Bug Title
675008

  21

bash: should handle /etc/bashrc.d (or similar) for non-login interactive shell

wishlist stable testing unstable 12 months ago

#678174#5
Date:
2012-06-19 18:28:22 UTC
From:
To:
Hi folks,

as was already mentioned in an aside in #593835: It's nice that
bash_completion is now enabled by default through /etc/profile.d, but
this only works for login shells. In particular, shells running in a
screen session or a terminal emulator like xterm, don't get bash
completion enabled right now.

This can cause confusion for users, when completion works in one shell,
but not the other. Also, when trying to fix this by enabling
bash_completion in /etc/bash.bashrc, it is enabled twice for login
shells, leading to extra login delays (though it seems
/etc/profile.d/bash_completion bails out if it's already loaded, so I
guess I've imagined this...).

I am aware that this issue is ultimately caused by how /etc/profile[.d]
works, and I do not know of any way to easily fix this (but that doesn't
mean there is none).

It seems to me that the best place to put the enabling code is in
/etc/bash.bashrc, but that's of course not up to the bash-completion
package.

One thing that springs to mind is to have bash offer an
/etc/bash.bashrc.d directory similar to /etc/profile.d, so
bash-completion can ship a hook in there instead of in /etc/profile.d.
Seems there's already a wishlist bug for that against bash: #675008.

Gr.

Matthijs

#678174#12
Date:
2012-12-16 14:58:09 UTC
From:
To:
Hi,

It seems that the wheezy version of bash now has bash-completion enabled
in /etc/skel/.bashrc, which would remove the need for this
/etc/profile.d/bash_completion.sh file altogether (though just removing
it would not offer painless migration for existing users, of course...).

Gr.

Matthijs