Skip to content

fix: recognize bunx.EXE/node.EXE argv0 on Windows (case-insensitive) - #38884

Closed
deepshekhardas wants to merge 1 commit into
oven-sh:mainfrom
deepshekhardas:fix-36826-bunx-case-insensitive-windows
Closed

fix: recognize bunx.EXE/node.EXE argv0 on Windows (case-insensitive)#38884
deepshekhardas wants to merge 1 commit into
oven-sh:mainfrom
deepshekhardas:fix-36826-bunx-case-insensitive-windows

Conversation

@deepshekhardas

Copy link
Copy Markdown

Fixes #36826

On Windows, executable-name detection compares argv0 case-sensitively: bunx.EXE (e.g. produced by PATH x PATHEXT resolution) is not recognized as bunx and bun misclassifies itself as plain bun, failing with error: Script not found. Same applies to node.exe vs NODE.EXE.

  • Add strings::ends_with_case_insensitive_ascii (mirror of the existing starts_with_case_insensitive_ascii) in src/bun_core/string/immutable.rs + unit test
  • Use it for is_bun_x/is_node on Windows in src/runtime/cli/mod.rs

@claude claude 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7cc583ca-bae4-4502-9cd6-79d39dae000b

📥 Commits

Reviewing files that changed from the base of the PR and between 6324a58 and ded1aa7.

📒 Files selected for processing (2)
  • src/bun_core/string/immutable.rs
  • src/runtime/cli/mod.rs

Walkthrough

The PR adds an ASCII case-insensitive suffix matcher and uses it to detect bunx and node executable names with varied casing on Windows. Tests cover matching, length mismatches, prefixes, and non-matching suffixes.

Changes

Windows executable detection

Layer / File(s) Summary
ASCII suffix matcher
src/bun_core/string/immutable.rs
Adds ends_with_case_insensitive_ascii and tests for case variants, suffix lengths, prefixes, and mismatches.
Windows CLI detection
src/runtime/cli/mod.rs
Uses case-insensitive suffix matching for Windows bunx and node executable detection. Non-Windows detection remains unchanged.

Suggested reviewers: jarred-sumner, robobun

Merge Risk: ⚪ Minimal · up to ded1a

This PR makes a localized Windows executable-name matching fix for bunx and node, with no actionable merge-blocking risk remaining beyond normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug and implementation, but it omits the required verification section and template headings. Add the required headings and document how the code was verified, including relevant Windows tests.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the Windows case-insensitive executable-name fix.
Linked Issues check ✅ Passed The changes address issue #36826 by recognizing case variations such as bunx.EXE and preserving correct bunx behavior on Windows.
Out of Scope Changes check ✅ Passed The helper, unit test, and Windows detection changes are directly related to the executable-name casing problem.

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.

@robobun

robobun commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR, @deepshekhardas. #36827 has been open for this same issue since Aug 3 and takes the same approach (an ASCII case-insensitive suffix helper used from is_bun_x / is_node), so I am closing this one in its favor rather than keeping two PRs open for #36826. What tipped it:

  • cli: match bunx/node invocation names case-insensitively #36827 also switches the non-Windows branches, so the behavior is observable and tested on every platform. It adds invocation tests for both the bunx and node names (test/cli/install/bunx.test.ts, test/cli/run/as-node.test.ts), and the issue reporter verified its Windows build against the original repro.
  • Its helper passes check_len = true to eql_case_insensitive_ascii. With check_len = false, as here, the comparator's debug assertions fire for an empty suffix. The current call sites never pass one, but the helper is public.
  • Two notes on the unit test in this PR, in case they are useful: ends_with_case_insensitive_ascii(b"bunx.EXE", b"bunx") is false (the last four bytes are .EXE), so the third assertion would fail if run. The bun.exe / bunx mismatch case, on the other hand, was missing from cli: match bunx/node invocation names case-insensitively #36827, so I folded it in over there with a Co-authored-by credit to you.

If you see anything #36827 still misses, please comment over there.

@robobun robobun closed this Aug 15, 2026
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.

Windows: bunx.EXE is misclassified as bun because executable-name detection is case-sensitive

2 participants