Control: retitle -1 qpdf: forbidden / incorrect use of bashcompinit, which may
clash with user-defined functions and with compdump
Control: severity -1 important
After a discussion in the zsh-workers list, the qpdf completer for zsh
must not use bashcompinit: bashcompinit is a function that should be
called only by the end user directly (if wanted), e.g. via an init
file.
One issue is that bashcompinit defines functions that are not reserved
and may be defined by the end user. Thus this can introduce breakage
on the user side:
qaa:~> complete() { true }
qaa:~> where complete
complete () {
true
}
qaa:~> qpdf [Tab][Tab]
qaa:~> where complete
complete () {
emulate -L zsh
local args void cmd print remove
args=("$@")
zparseopts -D -a void o: A: G: W: C: F: P: S: X: a b c d e f g j k u v
p=print r=remove
if [[ -n $print ]]
then
printf 'complete %2$s %1$s\n' "${(@kv)_comps[(R)_bash*]#* }"
elif [[ -n $remove ]]
then
for cmd
do
unset "_comps[$cmd]"
done
else
compdef _bash_complete\ ${(j. .)${(q)args[1,-1-$#]}} "$@"
fi
}
The user-defined function "complete" has been destroyed!
The solution:
The /usr/share/zsh/vendor-completions/_qpdf file should either be
removed or rewritten for zsh.
"qpdf --completion-zsh" could be preserved: its output is something
that the user can add in their .zshrc, knowing the side effects...
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)