Univention Bugzilla – Bug 54717
ucr command line completion not working in screen and sudo shells
Last modified: 2022-07-12 11:39:01 CEST
Noticed during support cases, Phoenix deployments and personal development machines: In UCS 5.0 the bash command line completion does not work in screen and sudo sessions that are not login sessions. After running `. /etc/profile` the commands in /etc/profile.d/bash_completion.sh are run and bash completion works. If `echo $BASH_COMPLETION_VERSINFO` doesn't produce output, then that's not been loaded. It works when you get a login shell as root directly.
Workaround: . /etc/profile.d/bash_completion.sh
Created attachment 10962 [details] Proposed patch Can we try with this one? I manually edited /etc/bash.bashrc on one of my VMs and rebooted it.
A "interactive *non*-login shell" starts sourcing `bashrc` instead of `profile`. In Debian the later `profile` always sources the former `bashrc` by default. While /etc/bash.bashrc does *not* source `bash_completion.sh`, this is done explicitly by /etc/skel/.bashrc which normal users get by default. Completion is neither sourced by /root/.profile nor by /root/.bashrc For a "root" *login* shell it still is sourced via /etc/profile These files are all installed by package "base-files" and shipped in /usr/hsare/base-files/{dot.{profile,bashrc},profile} But `screen` or `sudo` do *not* get completion sourced: Both do *not* use a "login-shell" by default; you have to explicitly request that using `sudo -i` or `screen -s -bash`. As such they use `/root/.bashrc` only, which does not source completion. See <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=275623#54> <https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html> # interactive login `bash --login` | `-bash` +- `--noprofile` +- /etc/profile | . /etc/bash.bashrc | . /etc/profile.d/*.sh | . /etc/profile.d/bash_completion.sh +--+- $HOME/.bash_profile +- $HOME/.bash_login +- $HOME/.profile . $HOME/.bashrc `sh --login` | `-sh` +- `--noprofile` +- /etc/profile +- $HOME/.profile # interactive non-login shell `bash -i` +--+- `--norc` +- `--rcfile …` +- $HOME/.bashrc +- /etc/bash.bashrc `sh -i` +- $ENV # non-interactive non-login shell `bash -c` | `#!/bin/bash` +- $BASH_ENV `sh -c` | `#!/bin/sh` NOTHING (In reply to Nikola Radovanovic from comment #2) > Created attachment 10962 [details] > Proposed patch No, the "bug" is in /root/.bashrc (AKA /usr/share/base-files/dot.bashrc) not sourcing /etc/profile.d/bash_completion.sh (In reply to Arvid Requate from comment #0) > In UCS 5.0 the bash command line completion does not work in screen and sudo > sessions that are not login sessions. Use `sudo -i` or `screen -s -bash` for now.
Thank you!