Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/semver/SemverQuery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@
let mut token = Token::default();
let mut prev_token = Token::default();

let mut count: u8 = 0;
let mut count: u32 = 0;

Check notice on line 725 in src/semver/SemverQuery.rs

View check run for this annotation

Claude / Claude Code Review

Parallel SemverQuery.zig still has u8 counter (install path unfixed)

FYI / pre-existing: this widens the counter in the Rust port, but the Zig source it was ported from — `src/semver/SemverQuery.zig:572` — still has `var count: u8 = 0;`. That Zig parser is still the active codepath for `bun install` (dependency.zig:882), lockfile workspace ranges (Package.zig:1045/1052), `bun pm view`, and `bun why`; only `Bun.semver.satisfies` goes through the Rust path, so the new test doesn't cover it. The same one-token widening (u8→u32) probably belongs there too — happy to
Comment thread
robobun marked this conversation as resolved.
let mut skip_round;
let mut is_or = false;

Expand Down
14 changes: 14 additions & 0 deletions test/cli/install/semver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

import { bunEnv, bunExe } from "harness";
import { unsortedPrereleases } from "./semver-fixture.js";
const { satisfies, order } = Bun.semver;

Expand Down Expand Up @@ -738,3 +739,16 @@ describe("Bun.semver.satisfies()", () => {
expect(unsortedPrereleases.sort(Bun.semver.order)).toMatchSnapshot();
});
});

test("a version range with >=256 || comparators does not abort", async () => {
const range = Array(300).fill("1.0.0").join(" || ");
await using proc = Bun.spawn({
cmd: [bunExe(), "-e", `process.stdout.write(String(Bun.semver.satisfies("1.0.0", ${JSON.stringify(range)})))`],
env: bunEnv,
stdout: "pipe",
stderr: "pipe",
});
const [stdout, exitCode] = await Promise.all([proc.stdout.text(), proc.exited]);
Comment thread
robobun marked this conversation as resolved.
Outdated
expect(stdout).toBe("true");
expect(exitCode).toBe(0);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
});
Loading