Hi, Ivan and Alban, Thank you very much for your reports. They certainly help me debug this large update.
I see two different issues: 1. Missing _comp_deprecate* functions Bash-completion 2.12 adds a new file to /etc/bash_completion.d (/etc/bash_completion.d/000_bash_completion_compat.bash), and this file contains several calls to _comp_deprecate_func and _comp_deprecate_var. These functions are only defined in version 2.12.0 of bash-completion. I believe that the problem that Ivan reported happened after the downgrade (from 2.12.0-1 to 2.11-8) and subsequently opening a new shell. This happens because the downgrade does not remove the file from /etc. I might need to move this file to a different location so that it gets removed by downgrades. 2. New completion files requiring new function from bash_completion This is mainly what Alban reported and the only solution I can think of is restarting the shell or re-sourcing bash-completion. Maybe we could have a downstream patch that provides this functions and tells the user that they must re-source bash-completion. Providing them as empty stubs would probably cause more harm than good, because the calling routines would then misbehave; Copying them from the older version could also work, but I fear that this would be a lot of work for me. On Tue, 30 Apr 2024 15:38:33 +0200 Alban Browaeys <pra...@yahoo.com> wrote: > Package: bash-completion > Followup-For: Bug #1070074 > > I doubt this issue is related to util-linux-extra being too old. > > I had a similar error while pressing "sudo<tab>" I got the error: > "sudo bash: _comp_initialize : commande introuvable" > ie "commande introuvable" is "command not found". > > It turned out that this error only happens in bash shell I had opened > before the upgrade (the fact you had the issue opening new bash shell is > awakward to me). The bash shell I opened after were fine. > > Note the _comp_deprecate_var, _comp_xxx functions are defined in > /usr/share/bash-completion/bash_completion > which is part of the bash-completion package, so upgrading > util-linux-extra can have no effect on them being present or not. > > From the error I got above I guess bash completion > /usr/share/bash-completion/completions/* > might get source anew after upgrade while the > /usr/share/bash-completion/bash-completion common function definition > file is not. > A way to workaround this issue would be to source this file in existing > bash shells: "source /usr/share/bash-completion/bash_completion" indeed > fixed my shell with broken "sudo<tab>" and missing _comp_initialize > command. > > I see no easy fix as as far as I know, the > /usr/share/bash-completion/bash_completion > is imported when the bash shell is started (profile file or bashrc) but it > seems the > completion files can be source during the shell runtime. > Maybe the a check at each completion files function call could be added > to check if /usr/share/bash-completion/bash_completion has changed and > source it when so. But this looks more like an upstream issue > than a Debian specific topic. > > NB: I still do not understand why you got the "command not found" when > opening a new bash shell. The new > /usr/share/bash-completion/bash_completion is source from the latest > version at this point. > Maybe your $HOME/.bashrc is not up to date: > > /etc/skel/.bashrc: (should be in your $HOME/.bashrc) > # If not running interactively, don't do anything > case $- in > *i*) ;; > *) return;; > esac > (...) > # enable programmable completion features (you don't need to enable > # this, if it's already enabled in /etc/bash.bashrc and /etc/profile > # sources /etc/bash.bashrc). > if ! shopt -oq posix; then > if [ -f /usr/share/bash-completion/bash_completion ]; then > . /usr/share/bash-completion/bash_completion > elif [ -f /etc/bash_completion ]; then > . /etc/bash_completion > fi > fi > > > /etc/bash.bashrc: > # enable bash completion in interactive shells > #if ! shopt -oq posix; then > # if [ -f /usr/share/bash-completion/bash_completion ]; then > # . /usr/share/bash-completion/bash_completion > # elif [ -f /etc/bash_completion ]; then > # . /etc/bash_completion > # fi > #fi > > or it is not imported from your $HOME/.profile which should have: > # if running bash > if [ -n "$BASH_VERSION" ]; then > # include .bashrc if it exists > if [ -f "$HOME/.bashrc" ]; then > . "$HOME/.bashrc" > fi > fi > > > but even then /etc/profile should have source the common bash completion > functions: > /etc/profile: > /etc/profile.d/bash_completion.sh > # shellcheck shell=sh disable=SC1091,SC2166,SC2268,SC3028,SC3044,SC3054 > # Check for interactive bash and that we haven't already been sourced. > if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a > "x${BASH_COMPLETION_VERSINFO-}" = x ]; then > > # Check for recent enough version of bash. > if [ "${BASH_VERSINFO[0]}" -gt 4 ] || > [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then > [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && > . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" > if shopt -q progcomp && [ -r > /usr/share/bash-completion/bash_completion ]; then > # Source completion code. > . /usr/share/bash-completion/bash_completion > fi > fi > > fi > > > > Cheers > Alban > > -- System Information: > Debian Release: trixie/sid > APT prefers unstable-debug > APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, > 'stable-debug'), (500, 'oldstable-debug'), (500, 'oldoldstable'), (500, > 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, > 'experimental-debug'), (1, 'experimental') > Architecture: amd64 (x86_64) > Foreign Architectures: i386 > > Kernel: Linux 6.9.0-rc5+ (SMP w/4 CPU threads; PREEMPT) > Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE > Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not > set > Shell: /bin/sh linked to /usr/bin/dash > Init: systemd (via /run/systemd/system) > LSM: AppArmor: enabled > > -- no debconf information