autocomplete script: default basename still uses full argv[0] path, Homebrew zsh/bash completion broken
Maintainers usually reply within 1 day
Assessment
This issue has not been assessed yet.
Description
Command attempted
scw autocomplete script shell=zsh (and shell=bash / shell=fish) when scw is invoked by absolute path. This is how Homebrew generates completions: the formula runs generate_completions_from_executable(bin/"scw", "autocomplete", "script", shell_parameter_format: :none), which calls the binary by its full Cellar path.
Expected Behavior
The generated script is named after the command (_scw, compdef _scw scw), regardless of how the binary was invoked, so a completion file written from it works.
Actual Behavior
The function and command names are derived from argv[0], so an absolute path ends up in the script:
$ /opt/homebrew/Cellar/scw/2.65.2/bin/scw autocomplete script shell=zsh
autoload -U compinit && compinit
_/opt/homebrew/Cellar/scw/2.65.2/bin/scw () {
output=($(/opt/homebrew/Cellar/scw/2.65.2/bin/scw autocomplete complete zsh -- ${CURRENT} ${words}))
...
}
compdef _/opt/homebrew/Cellar/scw/2.65.2/bin/scw /opt/homebrew/Cellar/scw/2.65.2/bin/scw
compdef registers completion for a command literally named /opt/homebrew/.../scw, so plain scw <TAB> falls back to file/directory completion. The bash variant has the same problem (complete -F _/opt/homebrew/.../scw /opt/homebrew/.../scw).
Homebrew writes this output to $(brew --prefix)/share/zsh/site-functions/_scw, so every brew install scw ships zsh completion that silently does nothing. The version-specific Cellar path is also baked in.
A second, smaller problem for the file-in-fpath case: the zsh script has no #compdef scw header, so even with a correct name compinit will not associate an autoloaded _scw file with scw. The current output only works when eval'd.
More info
scw version: 2.65.2 (Homebrew bottlearm64_tahoe), macOS 26 / Darwin arm64, zsh 5.9- Workaround that confirms the cause:
scw autocomplete script shell=zsh basename=scwproduces the correct_scw/compdef _scw scw. - Related: #3676 reported the same
argv[0]problem for bash and was closed by #3829, which added thebasenameargument. However its default is stillcore.ExtractBinaryName(ctx)(the fullargv[0]), so the output above is unchanged unless every caller passesbasename=scw. #1959 (shim/asdf) is the same root cause.
Suggested fix: default basename to filepath.Base(core.ExtractBinaryName(ctx)) (what #3676 originally asked for), and add #compdef scw as the first line of the zsh script. Alternatively, Homebrew could pass basename=scw in the formula, but fixing the default would help every packager and path-based invocation.
[!Note]
Responses generated with Claude (model: Claude Sonnet 5.5)
- Dominant language
- Go
- Stars
- 1k
- Forks
- 175
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 139
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from scaleway/scaleway-cli
-
False positive "configuration file permissions are too permissive" warning on WindowsPossibly taken @pypaut claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
scaleway/scaleway-cli#6492 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
instance security-group create -o json wraps the resource in a `security_group` key, unlike `get` and `list`May be free again @Mia-Cross claimed this 40 days ago, and no pull request is open. Openinstance
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
scaleway/scaleway-cli#6153 · 1 comment · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Use lipgloss for tabwriterPossibly taken @remyleone claimed this 2 days ago. Openenhancement
scaleway/scaleway-cli#6608 · 1 assignee ·
Maintainers usually reply within 1 day
-
Add abstraction layer for colorsPossibly taken @remyleone claimed this 4 days ago. Openenhancement ux
scaleway/scaleway-cli#6572 · 1 assignee ·
Maintainers usually reply within 1 day
-
Add support for displaying the annotation of a resource in its getPossibly taken @estellesoulard claimed this 2 days ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
scaleway/scaleway-cli#6570 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in scaleway/scaleway-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
docs(prompts): IF BLOCKED workflow-scope branch says to comment on the issue on jira/local trackersOpenagent-butler-finding bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
jordansmall/spindrift#6238 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
microcks/microcks-cli#608 · 1 comment ·
Maintainers usually reply within 1 day
-
bug from-studio
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
esengine/DeepSeek-Reasonix#14868 ·
Maintainers usually reply within 1 day
-
Install notes print "Camunda REST API: https://" without a host when global.host is setPossibly taken @irisfield claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
camunda/camunda-platform-helm#7790 ·
Maintainers usually reply within 1 day