Skip to content

fix(completions): undefined variable leading to bash completion errors - #26743

Open
carschandler wants to merge 1 commit into
oven-sh:mainfrom
carschandler:main
Open

fix(completions): undefined variable leading to bash completion errors#26743
carschandler wants to merge 1 commit into
oven-sh:mainfrom
carschandler:main

Conversation

@carschandler

Copy link
Copy Markdown

What does this PR do?

Fixes #24847

Not sure what the original intent of this undefined variable was but I'd rather have a working version than try to fully fix that functionality

How did you verify your code works?

Edited the currently installed completions script from my bun install with identical changes

Fixes oven-sh#24847

Not sure what the original intent of this undefined script was but I'd
rather have a working version than try to fix it
@coderabbitai

coderabbitai Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Removed an alternative condition in the bash completion script's _read_scripts_in_package_json function that previously allowed triggering completion via re_comp_word_script pattern matching. Completion now only proceeds when previous-completion matches re_prev_script and COMP_WORDS[2] is non-empty, tightening the trigger logic.

Changes

Cohort / File(s) Summary
Bash Completion Logic
completions/bun.bash
Removed secondary guard condition in _read_scripts_in_package_json that depended on re_comp_word_script matching. Narrows completion trigger to only proceed when COMPREPLY matches re_prev_script and COMP_WORDS[2] is non-empty.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(completions): undefined variable leading to bash completion errors' clearly and specifically describes the main change - fixing an undefined variable that causes bash completion errors.
Description check ✅ Passed The description includes both required sections from the template: 'What does this PR do?' with a link to the issue and explanation, and 'How did you verify your code works?' with verification details.
Linked Issues check ✅ Passed The code changes address the core requirement from issue #24847: removing the undefined variable in the bash completions script that caused the 'invalid regular expression' error, restoring functional tab completion.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the bash completion error in completions/bun.bash by removing the problematic secondary condition, with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
completions/bun.bash (1)

1-1: 🧹 Nitpick | 🔵 Trivial

Pre-existing: Shebang is malformed.

The shebang line is missing ! and should be #!/usr/bin/env bash. While completion scripts are typically sourced rather than executed directly (so this may not cause immediate issues), it's still incorrect.

Proposed fix
-#/usr/bin/env bash
+#!/usr/bin/env bash

@claude

claude Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Code Review

No issues found. Checked for bugs and CLAUDE.md compliance.

@robobun

robobun commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Keeping this one as the fix for #24847 (triaging the open completion PRs). Notes for whoever merges:

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.

bash_completion bug (macos bash)

2 participants