User-local Bash completions not loading

Bug #2072618 reported by Lucas Sandery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
New
Undecided
Unassigned
python-argcomplete (Ubuntu)
New
Undecided
Unassigned

Bug Description

I'm on Noble. I don't believe there's anything special about my environment with respect to Bash completions. I had pipx installed to prevent conflicts with the system python, which brings in the python3-argcomplete package. I've temporarily removed the former but kept the latter, in order to investigate my problem.

When argcomplete is installed, completions in ~/.local/share/bash-completion/completions/ do not load or run. Their underscore-prefixed functions do not appear in the environment. To test, I created a file there for the non-existent command "zz", with these contents:

_zz () {
    COMPREPLY=($(compgen -W 'foo bar baz qux' -- "$2"))
} && complete -F _zz zz

At a fresh Bash prompt, I type "zz " then hit Tab. It will only complete filenames from the current dir, not from the specified argument set. Under "bash -x", the trace after doing so begins with this:

+ [[ -n '' ]]
+ local _BASH_REMATCH=
+ local executable=
+ req_argv=()
+ local req_argv
+ [[ -z '' ]]
+ executable=zz
+ req_argv=("" "${COMP_WORDS[@]:1}")
+ __python_argcomplete_expand_tilde_by_ref executable
...

If I uninstall the argcomplete package and do the same, fresh prompt each time, my completions work again. I can reliably toggle this behaviour by reinstalling & uninstalling it. The successful trace begins with this:

+ local cmd=zz
+ __load_completion zz
+ dirs=('/home/l/.local/share/bash-completion/completions')
+ local -a dirs
...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.