Since version 1.90, bash-completion has new completion loading code. The completion files are loaded on demand, with ${completionsdir}/${command} being sourced when a matching command is typed. This requires the completion files to be named for all commands provided by package. Currently, pulseaudio installs a single pulseaudio-bash-completion.sh which simply does not work with this scheme. It needs to install 'pactl', 'pacmd', ..., 'pulseaudio' files instead. This can be achieved in two ways. Either: 1. install a single completion file (e.g. 'pulseaudio') and symlinkother completed commands to it, 2. install common functions into e.g. $helpersdir/pulseaudio and separate scripts (sourcing the common functions) for each completed command.
I'd be ok with either suggested solutions. Would you be willing to write a patch?
Sure, will do.
Created attachment 108002 [details] [review] [PATCH 1/2] build-sys: Alias bash-completion for all PulseAudio commands
Created attachment 108003 [details] [review] [PATCH 2/2] build-sys: Support overriding bash completion directory
Here are my patches that improve the install. (1) renames the completion file to 'pulseaudio', and creates symlinks for other commands. (2) adds --with-bash-completion-dir to control the completion install location alike zsh is supported now. This also changes the default to use pkg-config and fallback to the default upstream location if it's not available.
Thanks for the patches! I applied the first one, but I'm hesitant to apply the second one. The reason is that since you use pkg-config to read the installation directory, it seems likely that we end up overwriting the distro's completion files when installing from source, and I'd really like to avoid that. In case of Zsh, we install the completion file under /usr/local by default, and I recently managed to convince the Zsh developers to add /usr/local/share/zsh/site-functions to the list of default directories, so even if Zsh is provided by the distro and is compiled with --prefix=/usr, it still knows to look under /usr/local for function definitions. It would be great if Bash supported this too.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/394.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.