Closed actualben closed 4 months ago
Looks like the issue is that the output of keyring --print-completion bash
(which brew uses for completion) is invalid:
Install keyring[completion] for completion support.
Homebrew has now switched to shtab for keyring completions so a brew upgrade should address the symptoms for homebrew users.
Looks like the issue is that the output of
keyring --print-completion bash
(which brew uses for completion) is invalid:Install keyring[completion] for completion support.
And that error message is indicating the problem. When running keyring without the completion
extra, it will emit that message.
~ @ pip-run keyring -- -m keyring --print-completion bash
Install keyring[completion] for completion support.
When running with the extra, it emits the completion logic:
~ @ pip-run 'keyring[completion]' -- -m keyring --print-completion bash | head -n 5
# AUTOMATICALLY GENERATED by `shtab`
_shtab___main___py_option_strings=('-h' '--help' '-p' '--keyring-path' '-b' '--keyring-backend' '--list-backends' '--disable' '--print-completion')
It sounds like the homebrew recipe just needed to include the completion extra in its install. Since the only package installed by the completion extra is shtab, the presence or absence of that package will determine whether the completion generation completes or not.
I do wonder if perhaps keyring should exit with a non-zero exit code here when the completion dependencies aren't present.
Would that have helped catch this issue earlier (prior to release)?
Yeah I think non-zero exit makes sense and also having the error message go to sys.stderr instead of stdout may prevent this kind of thing.
Fixed in v25.0.1.
Describe the bug Homebrew seems to be installing an invalid completion file in
/opt/homebrew/etc/bash_completion.d/keyring
. These files are sourced at shell startup but the one homebrew is installing is not valid shell code. I'm not sure if the problem is here or in the homebrew package - the recent keyring package release on homebrew doesn't seem like the kind of change that could cause this, but I'm not sure.As a result of this when I open a new interactive shell session, I see:
Because the
bash_completion.d/keyring
launches/usr/bin/install
due to the case-insensitive filesystem nonsense on macOS.To Reproduce Steps to reproduce the behavior:
brew install bash bash-completion keyring
cat $(brew --prefix)/etc/bash_completion.d/keyring
Expected behavior A valid shell completion function definition should be in
bash_completion.d/keyring
or no file should be installed hereEnvironment
Additional context
Here's a trace of my shell startup showing the issue: