1

For the past couple of weeks or so, I've noticed that, often, when I press the Tab key to try and complete a command in a bash shell in a terminal, I get an error message. It says:

bash: _split_longopt: command not found

What could cause this, and how can I fix it?

Notes:

  • The file /usr/share/bash-completion/bash_completion is present, and I haven't modified it myself. It has a function named _comp__split_longopt.

Note: I'm using Devuan Excalibur (~= Debian Trixie without systemd).

3
  • AFAIK the function should be found in /usr/share/bash-completion/bash_completion - have you modified that file? Commented Aug 11, 2024 at 19:15
  • @steeldriver: See edit. Commented Aug 11, 2024 at 20:19
  • Ah yes so it seems like _split_longopt rename is breaking downstream (3rd party) completion scripts - I guess that's the downside of using a "testing" version Commented Aug 11, 2024 at 20:25

2 Answers 2

4

Apparently, while the _split_longopt function is gone from /usr/share/bash-completion/bash_completion, there are still lots of packages which rely on its existence:

$ grep -rl "\\b_split_longopt\\b" *
completions/opensc-asn1
completions/netkey-tool
completions/pkcs15-init
completions/opensc-notify
completions/eidenv
completions/dtrust-tool
completions/goid-tool
completions/opensc-tool
completions/npa-tool
completions/iasecc-tool
completions/grub
completions/pkcs11-register
completions/dnie-tool
completions/cmake
completions/cryptoflex-tool
completions/sc-hsm-tool
completions/westcos-tool
completions/pkcs11-tool
completions/egk-tool
completions/openpgp-tool
completions/piv-tool
completions/opensc-explorer
completions/pkcs15-tool
completions/cardos-tool
completions/gids-tool
completions/pkcs15-crypt

As @steeldriver notes, this is likely due to your using a testing version of a distribution, which is undergoing possibly-breaking changes. At some point before Debian Trixie / Devuan Excalibur is released, this should get fixed.

In the mean time... you could replace the function name in all those files, like so:

sudo sed -ri s'/_split_longopt/_comp__split_longopt/' \
$(grep -rl "\\b_split_longopt\\b" /usr/share/bash-completion)
2
  • 1
    Or more pragmatically, add this to your .bashrc: _split_longopt { _comp__split_longopt "$@"; } Commented May 14 at 10:01
  • @TheMadsen: Please edit that into the bottom of my answer, or if you like - make it a separate answer. Commented May 14 at 23:17
4

@einpoklum: Thanks for locating the root cause. As requested ..

Or more pragmatically, do what the developers should have done in the first place; Make it backwards compatible. So, just add this to your .bashrc:

_split_longopt() { _comp__split_longopt "$@"; }

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.