Bug 84921

Summary: pulseaudio-bash-completion.sh install unfit for completion autoloading
Product: PulseAudio Reporter: Michał Górny <mgorny>
Component: miscAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: gnome, lennart
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=521170
Whiteboard:
i915 platform: i915 features:
Attachments: [PATCH 1/2] build-sys: Alias bash-completion for all PulseAudio commands
[PATCH 2/2] build-sys: Support overriding bash completion directory

Description Michał Górny 2014-10-11 21:01:26 UTC
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.
Comment 1 Tanu Kaskinen 2014-10-17 11:14:55 UTC
I'd be ok with either suggested solutions. Would you be willing to write a patch?
Comment 2 Michał Górny 2014-10-17 18:03:58 UTC
Sure, will do.
Comment 3 Michał Górny 2014-10-17 19:23:41 UTC
Created attachment 108002 [details] [review]
[PATCH 1/2] build-sys: Alias bash-completion for all PulseAudio commands
Comment 4 Michał Górny 2014-10-17 19:24:02 UTC
Created attachment 108003 [details] [review]
[PATCH 2/2] build-sys: Support overriding bash completion directory
Comment 5 Michał Górny 2014-10-17 19:26:13 UTC
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.
Comment 6 Tanu Kaskinen 2014-10-28 10:59:19 UTC
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.
Comment 7 GitLab Migration User 2018-07-30 10:23:54 UTC
-- 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.