#1127788 qpdf: bash completion seems to be totally broken

Package:
qpdf
Source:
qpdf
Description:
tools for transforming and inspecting PDF files
Submitter:
Francesco Poli (wintermute)
Date:
2026-08-09 23:21:01 UTC
Severity:
normal
#1127788#5
Date:
2026-02-12 23:22:09 UTC
From:
To:
Hello and thanks for maintaining qpdf!

I would like to point out that its bash completion seems to be totally
broken.

For instance:

    $ ls
    foo.pdf
    $ qpdf fo

if I now hit [Tab], I get the following awkward result:

    $ qpdf fo
    qpdf: an input file name is required

    For help:
      qpdf --help=usage       usage information
      qpdf --help=topic       help on a topic
      qpdf --help=--option    help on an option
      qpdf --help             general help and a topic list

    o.pdf

The problema seems to lie in the qpdf executable itself, which is
supposed to be able to generated its own bash completion code:

    $ dpkg -L qpdf | grep bash-completion
    /usr/share/bash-completion
    /usr/share/bash-completion/completions
    /usr/share/bash-completion/completions/qpdf
    $ cat /usr/share/bash-completion/completions/qpdf
    eval "$(/usr/bin/qpdf --completion-bash)"

but:

    $ /usr/bin/qpdf --completion-bash
    qpdf_completer() { '/usr/bin/qpdf'; }; complete -o bashdefault -o default -o nospace -F qpdf_completer qpdf

I am no expert of bash completion code, but the qpdf_completer()
function does not look like a working bash completion function...

What's wrong?
Is there anything I failed to understand?

Please clarify or fix the bug.


Thanks for your time and dedication!

#1127788#10
Date:
2026-03-22 19:32:01 UTC
From:
To:
So it's not _totally_ broken. Completion still works if you can mentally remove the inline documentation every time you hit tab. But, I agree, that's not a real solution.

I suspect that the breaking change came from commit 
https://github.com/qpdf/qpdf/commit/29631cabd62f8a9790b5ea9c358fc6557fa17d2b because that was the last to touch /usr/share/bash-completion/completions/qpdf . It appears it was over-fixed.

#1127788#15
Date:
2026-03-22 22:02:42 UTC
From:
To:
I'm working on a complete redo of the competition support. Hopefully that can put an end to this once and for all. Sorry for the formatting... Sending from my phone.
#1127788#20
Date:
2026-08-02 01:37:21 UTC
From:
To:
Whilst we wait for that complete redo, here's a duct tape fix:

# Save to /etc/bash_completion.d/qpdf

_qpdf_completions() {
  local IFS=$' \t\n'

  local cur; cur="${COMP_WORDS[COMP_CWORD]}"

  if [[ "${cur}" == -* ]]
  then
    if [[ ! "${_QPDF_OPTS:-}" ]]
    then
      _QPDF_OPTS=$(man qpdf 2>/dev/null |
        col --no-backspaces |
        grep --only-matching --extended-regexp '\-\-[[:alnum:]-]+|\-[[:alnum:]]+' |
        sort --unique |
        tr '\n' ' ')
    fi
    COMPREPLY=( $(compgen -W "${_QPDF_OPTS}" -- "${cur}") )
    return 0
  fi
  COMPREPLY=( $(compgen -f -X '!*.pdf' -- "${cur}") )
}

complete -F _qpdf_completions qpdf

#1127788#25
Date:
2026-08-09 23:19:13 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
qpdf, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1127788@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jay Berkenbilt <qjb@debian.org> (supplier of updated qpdf package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 09 Aug 2026 16:49:00 -0400
Source: qpdf
Architecture: source
Version: 12.4.0-1
Distribution: unstable
Urgency: medium
Maintainer: Jay Berkenbilt <qjb@debian.org>
Changed-By: Jay Berkenbilt <qjb@debian.org>
Closes: 1111421 1127788
Changes:
 qpdf (12.4.0-1) unstable; urgency=medium
 .
   * New upstream release.
   * This version includes completely rewritten bash and zsh completion
     files that no longer invoke the qpdf executable. (Closes: #1127788)
   * Update the manual page to reference the qpdf-doc package.
     (Closes: #1111421)
   * Standards version updated to 4.7.4; no changes needed.
Checksums-Sha1:
 890e676a18e1413572121558b13213fe579be160 2405 qpdf_12.4.0-1.dsc
 829ce85b097a16711e75c6c2c896ecfc12e05d53 19675978 qpdf_12.4.0.orig.tar.gz
 a32028b6aacf355c060d3e99747f296ce3d846dc 833 qpdf_12.4.0.orig.tar.gz.asc
 4f80d6188eda8f8f1720e1fd0d7d9470ab89c944 15816 qpdf_12.4.0-1.debian.tar.xz
 7a631f11963475d563bf2077d0008636ac3eb5c7 12287 qpdf_12.4.0-1_amd64.buildinfo
Checksums-Sha256:
 2465054647850be91f0785a7150309ee92260674a5aee651fb973bbbaa32ffde 2405 qpdf_12.4.0-1.dsc
 2783a032f443cc886dad41aa6d5fae3dabf23dec00ee7ec2cfb27ef67ebcf529 19675978 qpdf_12.4.0.orig.tar.gz
 ed14b50cb88bb0bc490811ea647320d4e27db19e65dcb5e98dfe9593b9a14edc 833 qpdf_12.4.0.orig.tar.gz.asc
 4dd8597dc78ec558d2880659c7e87d44fbff925ff9d4314c2a4a246d537fbcbf 15816 qpdf_12.4.0-1.debian.tar.xz
 5316cd103e878118cb2f2af0b8c36f655a44e065135fabd7cafa360f09f3401a 12287 qpdf_12.4.0-1_amd64.buildinfo
Files:
 dd2b07a702efb2deac2ec6355d95a4f5 2405 libs optional qpdf_12.4.0-1.dsc
 d3156920305cafe5b554dcf36cf3cfe7 19675978 libs optional qpdf_12.4.0.orig.tar.gz
 39706d25604677d2bec0125a22766e70 833 libs optional qpdf_12.4.0.orig.tar.gz.asc
 9bad7d8429e8035a59abbb02bb70c40b 15816 libs optional qpdf_12.4.0-1.debian.tar.xz
 d7070da49d424d3938e47214c7d34c4f 12287 libs optional qpdf_12.4.0-1_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEwslrEAEf4Anm0d+CinXRCZgBLH4FAmp46dsPHHFqYkBkZWJp
YW4ub3JnAAoJEIp10QmYASx+US8P/1rhOtXPmhzkpZkNg8VQh/P2FqAIs1jUxf/W
2A1/72smJGjGcLfzKk9KuAOlTbtrME1WGJDeAgv7aGq/bdfCIBgGeWliZM/IrH02
cmaH/3j37ksQLS8mcQfEksPmQd0BRZUx3/5YBi6swJR2dojS2cJ6tynslKdBoQH+
YUkyPs+x/1IB4s7bzkxQGtCLZIZqyPttlbz9IQkCd0QNqlsVS/47mP1VxmVEpVzy
wKVPU4L57+00bvWk0kA020qh3uitFtvi3dB7Ok0ln93xphBUQpT6sAqJnvjyt8j1
ffr/c46tfstnMek8tAM2TxOX0tLt4iMvcQoVRgGynO3xhf/0wzC2aqV6Q6i8/miR
+DcSeU5A9jhFWqYGOQ049JjHU8pPKDsgMCUSdyoI1aJhnbKwbNSOdFV4i/PZjBcc
757COSIdpK0AnztBUSaF6DwK+8IYWBVuhY2XOwIzGzYVCFTRgvGI/QeqDfuVUhlz
akFPbz338xZOlgGnkzizGP9va1cBpwpsXzCbn0TIg5MV5cSNFDE9DUILW1vjp8ox
lMhupN4/m+GQGZkG434PpDseXuJVYJvj36uqdFQQsFZpAqjWMJJJch504TjVJeI0
fFI6g/v+roQ4UVx8GQKrMV+coUvAYV1bpVbOWDFg7o5i4Lk35XM/KnB7k85dM2a7
kDxOU2ja
=4O6i
-----END PGP SIGNATURE-----