Skip to content

fix: drop shebang from bash completion template#2317

Merged
dearchap merged 1 commit intourfave:mainfrom
barry3406:fix/completion-shebang
Apr 18, 2026
Merged

fix: drop shebang from bash completion template#2317
dearchap merged 1 commit intourfave:mainfrom
barry3406:fix/completion-shebang

Conversation

@barry3406
Copy link
Copy Markdown

What type of PR is this?

  • bug

What this PR does / why we need it:

Bash completion scripts are sourced (not executed), so they shouldn't start with a #!/bin/bash shebang. Debian's lintian flags the generated completion with bash-completion-with-hashbang when downstream packagers ship it.

  • autocomplete/bash_autocomplete: drops the shebang line (and the blank line that followed it) so the embedded template starts with the existing # This is a shell completion script ... header comment.
  • completion_test.go: adds TestCompletionBashNoShebang, which renders the bash completion via shellCompletions["bash"] and asserts the output does not start with #!.

Which issue(s) this PR fixes:

Fixes #2259

Testing

go test ./... and go vet ./... pass locally. The new test fails without the template change and passes with it.

Release Notes

fix: drop shebang from bash completion template so it no longer trips `bash-completion-with-hashbang` when sourced

Bash completion scripts are sourced, not executed, so they should
not begin with a `#!/bin/bash` shebang. Debian's lintian flags this
as `bash-completion-with-hashbang`.

Add a regression test that renders the bash completion and asserts
the output does not start with `#!`.

Fixes urfave#2259
@barry3406 barry3406 requested a review from a team as a code owner April 17, 2026 03:08
@dearchap dearchap merged commit 2925d6f into urfave:main Apr 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

completion should not have shebang

2 participants