Package: bash-completion Version: 1:2.7-1 Severity: important File: /usr/share/bash-completion/completions/man Usertags: regression Tags: patch
I have a manual page path set to some additional manuals. I set MANPATH to include a final colon so that man will append its default set of paths to the variable. The MANPATH value can also have the colon at the start for prepending or have a double colon for inserting. $ MANPATH=foo manpath manpath: warning: $MANPATH set, ignoring /etc/manpath.config foo $ MANPATH=foo: manpath manpath: warning: $MANPATH set, appending /etc/manpath.config foo:/usr/local/man:/usr/local/share/man:/usr/share/man $ MANPATH=:foo manpath manpath: warning: $MANPATH set, prepending /etc/manpath.config /usr/local/man:/usr/local/share/man:/usr/share/man:foo $ MANPATH=bar::foo manpath manpath: warning: $MANPATH set, inserting /etc/manpath.config bar:/usr/local/man:/usr/local/share/man:/usr/share/man:foo Unfortunately the new version of the manual page completion unconditionally uses $MANPATH when it is set instead of leaving interpretation of the variable up to the manpath command: local manpath="$MANPATH" [[ -z $manpath ]] && \ manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null ) [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" The old version of the manual page completion used the output of the manpath command instead, which includes the above colon semantics. local manpath if [[ $OSTYPE == *@(darwin|linux|freebsd|cygwin)* ]] || _userland GNU; then manpath=$( manpath 2>/dev/null || command man --path ) else manpath=$MANPATH fi I think the correct version should look like this: local manpath manpath=$( manpath 2>/dev/null || command man -w 2>/dev/null || command man --path 2>/dev/null ) [[ -z $manpath ]] && manpath=$MANPATH [[ -z $manpath ]] && manpath="/usr/share/man:/usr/local/share/man" This satisfies several issues for the manual path: * The first choice for manpath should always be the output of the commands, because they are the arbiter of MANPATH semantics. * All three commands should be used to cover all man versions * The second choice should be MANPATH in case the user set it to workaround their manual path commands not working. * The third choice should be a reasonable FHS-compliant default -- System Information: Debian Release: buster/sid APT prefers testing-debug APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 'unstable-debug'), (800, 'unstable'), (790, 'buildd-unstable'), (700, 'experimental-debug'), (700, 'experimental'), (690, 'buildd-experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.14.0-3-amd64 (SMP w/4 CPU cores) Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8), LANGUAGE=en_AU.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) -- no debconf information -- bye, pabs https://wiki.debian.org/PaulWise
signature.asc
Description: This is a digitally signed message part