FS#74507 - pacman zsh completion defines _keys in the global name space causing weird collisions

Attached to Project: Pacman
Opened by Arvid Norlander (VorpalGun) - Tuesday, 19 April 2022, 13:43 GMT
Task Type Bug Report
Category General
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version 6.0.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Summary and Info:
The zsh completion (_pacman) defines several helper functions. These end up in the global namespace of zsh. Most of which are prefixed with _pacman, making name collisions unlikely. There is also _makepkg where again a name collision is unlikely (since the convention is to name the completion function after your command prefxed with _). However there is _keys defined, which ended up colliding for me, causing hard to debug issues (sometimes my completion function would be overwritten, sometimes pacman completion would break) depending on which order the completion scripts happened to load in.

It would be great if a prefixed name could be used instead for this helper function.

Note that _key_shortopts and _key_longopts should probably also be renamed to have a prefix, though I didn't happen to collide with those.

Steps to Reproduce:
1. Start a new zsh shell
2. Define a _keys function in zsh (for completing a command "keys" for example).
3. Try to tab complete a pacman command
4. Observe using the `type` builtin that your _keys has been overwritten

The opposite can be accomplished by switching step 2 and 3, resulting in pacman completion being broken.
This task depends upon

Loading...