Skip to content

Conversation

@robobun
Copy link
Collaborator

@robobun robobun commented Jan 21, 2026

Summary

  • When a glob pattern doesn't match any files, pass the literal pattern to the command instead of erroring with "no matches found"
  • This matches bash's default behavior (vs zsh's failglob)
  • Scripts like rimraf dist/* now work when dist directory doesn't exist

Test plan

  • Added regression test for issue bun: no matches found: dist/* #26317
  • Updated existing glob expansion test to expect new behavior
  • Verified fix passes with bun bd test
  • Verified tests fail with USE_SYSTEM_BUN=1 (before fix)

Fixes #26317

🤖 Generated with Claude Code

When a glob pattern doesn't match any files, pass the literal pattern to
the command instead of erroring with "no matches found". This matches
bash's default behavior (vs zsh's failglob).

Fixes #26317

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@robobun
Copy link
Collaborator Author

robobun commented Jan 21, 2026

Updated 9:30 PM PT - Jan 20th, 2026

❌ Your commit adc9c945 has 1 failures in Build #35470 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 26318

That installs a local version of the PR into your bun-26318 executable, so you can run:

bun-26318 --bun

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

Glob expansion behavior when patterns match no files is modified. Previously, the system would error on zero matches; now it consistently passes the literal pattern through. The implementation, existing tests, and regression test are updated to reflect this behavior change.

Changes

Cohort / File(s) Summary
Core shell expansion logic
src/shell/states/Expansion.zig
Modified onGlobWalkDone to always pass the literal pattern to output when glob yields zero matches, instead of conditionally returning an error. Implements bash-like pass-through behavior for non-matching globs.
Test updates
test/js/bun/shell/bunshell.test.ts, test/regression/issue/26317.test.ts
Updated glob expansion test expectations from fail (exit code 1) to pass (exit code 0 with literal pattern). Added new regression test for issue #26317 validating that unmatched globs pass literal patterns rather than error.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(shell): pass literal pattern when glob matches no files' is concise and clearly summarizes the main change in the codebase - addressing how glob patterns with no matches are handled.
Description check ✅ Passed The PR description adequately covers both required template sections with clear summary, test plan, and verification steps, though it goes beyond the minimal template.
Linked Issues check ✅ Passed The code changes align with issue #26317 requirements: glob patterns with no matches now pass the literal pattern to commands (matching bash behavior) instead of erroring, fixing the 'rimraf dist/*' failure scenario.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing glob expansion behavior: modifications to Expansion.zig core logic, updated tests for the new behavior, and a regression test for issue #26317.

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


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bun: no matches found: dist/*

2 participants