Skip to content

Tags: wmh/bun

Tags

bun-v1.3.3

Toggle bun-v1.3.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
test(ENG-21524): Fuzzilli Stop-Gap (oven-sh#24826)

### What does this PR do?

Adds [@mschwarzl's Fuzzilli Support
PR](oven-sh#23862) with the changes
necessary to be able to:

- Run it in CI
- Make no impact on `debug` and `release` mode.

### How did you verify your code works?

---------

Co-authored-by: Martin Schwarzl <mschwarzl@cloudflare.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>

bun-v1.3.2

Toggle bun-v1.3.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
ci: run modified tests first (oven-sh#24463)

Co-authored-by: Meghan Denny <meghan@bun.com>

bun-v1.3.1

Toggle bun-v1.3.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Refactor napi_env to use Ref-counted NapiEnv (oven-sh#23940)

### What does this PR do?

Replaces raw napi_env pointers with WTF::Ref<NapiEnv> for improved
memory management and safety. Updates related classes, function
signatures, and finalizer handling to use reference counting. Adds
ref/deref methods to NapiEnv and integrates them in Zig and C++ code
paths, ensuring proper lifecycle management for N-API environments.

### How did you verify your code works?

bun-v1.3.0

Toggle bun-v1.3.0's commit message
Update no-validate-leaksan.txt

bun-v1.2.23

Toggle bun-v1.2.23's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat(sql.array) add support to sql.array (oven-sh#22946)

### What does this PR do?
Fixes oven-sh#17030 
In this case should work as expected just passing a normal array should
be serialized as JSON/JSONB

Fixes oven-sh#17798
Insert and update helpers should work as expected here when using
sql.array helper:

```sql
CREATE TABLE user (
    id SERIAL PRIMARY KEY,
    name VARCHAR NOT NULL,
    roles TEXT[]
);
```

```js
const item = { id: 1, name: "test", role: sql.array(['a', 'b'], "TEXT") };
await sql`
  UPDATE user
  SET ${sql(item)}
  WHERE id = 1
`;
```
Fixes oven-sh#22281
Should work using  sql.array(array, "TEXT")

Fixes oven-sh#22165
Fixes oven-sh#22155
Add sql.array(array, typeNameOrTypeID) in Bun.SQL
(oven-sh#15088)

### How did you verify your code works?
Tests

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

bun-v1.2.22

Toggle bun-v1.2.22's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix Windows shell crash with && operator and external commands (oven-…

…sh#22651)

## What does this PR do?

Fixes oven-sh#22650
Fixes oven-sh#22615
Fixes oven-sh#22603
Fixes oven-sh#22602

Fixes a crash that occurred when running shell commands through `bun
run` (package.json scripts) on Windows that use the `&&` operator
followed by an external command.

### The Problem

The minimal reproduction was:
```bash
bun exec 'echo && node --version'
```

This would crash with: `panic(main thread): attempt to use null value`

### Root Causes

Two issues were causing the crash:

1. **Missing top_level_dir**: When `runPackageScriptForeground` creates
a MiniEventLoop for running package scripts, it wasn't setting the
`top_level_dir` field. This caused a null pointer dereference when the
shell tried to access it.

2. **MovableIfWindowsFd handling**: After PR oven-sh#21800 introduced
`MovableIfWindowsFd` to handle file descriptor ownership on Windows, the
`IOWriter.fd` could be moved to libuv, leaving it null. When the shell
tried to spawn an external command after a `&&` operator, it would crash
trying to access this null fd.

### The Fix

1. Set `mini.top_level_dir = cwd` after initializing the MiniEventLoop
in `run_command.zig`
2. In `IO.zig`, when the fd has been moved to libuv (is null), use
`.inherit` for stdio instead of trying to pass the null fd

### How did you verify your code works?

- Added a regression test that reproduces the issue
- Verified the test fails without the fix and passes with it
- Tested the minimal reproduction command directly
- The fix correctly allows both commands in the `&&` chain to execute

```bash
# Before fix: crashes
> bun exec 'echo test && node --version'
panic(main thread): attempt to use null value

# After fix: works correctly
> bun exec 'echo test && node --version'
test
v22.4.1
```
<sub>
also probably fixes oven-sh#22615 and fixes oven-sh#22603 and fixes oven-sh#22602
</sub>

---------

Co-authored-by: Zack Radisic <zack@theradisic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

bun-v1.2.21

Toggle bun-v1.2.21's commit message
De-flake shell-load.test.ts

bun-v1.2.20

Toggle bun-v1.2.20's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix integer cast truncation panic on Windows for buffers > 4GB (oven-…

…sh#21738)

## Summary
This PR fixes a panic that occurs when file operations use buffers
larger than 4GB on Windows.

## The Problem
When calling `fs.readSync()` or `fs.writeSync()` with buffers larger
than 4,294,967,295 bytes (u32::MAX), Bun panics with:
```
panic(main thread): integer cast truncated bits
```

## Root Cause
The Windows APIs `ReadFile()` and `WriteFile()` expect a `DWORD` (u32)
for the buffer length parameter. The code was using `@intCast` to
convert from `usize` to `u32`, which panics when the value exceeds
u32::MAX.

## The Fix
Changed `@intCast` to `@truncate` in four locations:
1. `sys.zig:1839` - ReadFile buffer length parameter
2. `sys.zig:1556` - WriteFile buffer length parameter  
3. `bun.zig:230` - platformIOVecCreate length field
4. `bun.zig:240` - platformIOVecConstCreate length field

With these changes, operations with buffers > 4GB will read/write up to
4GB at a time instead of panicking.

## Test Plan
```js
// This previously caused a panic on Windows
const fs = require('fs');
const fd = fs.openSync('test.txt', 'r');
const buffer = Buffer.allocUnsafe(4_294_967_296); // 4GB + 1 byte
fs.readSync(fd, buffer, 0, buffer.length, 0);
```

Fixes oven-sh#21699

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Jarred Sumner <jarred@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>

bun-v1.2.19

Toggle bun-v1.2.19's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Update interactive spacing (oven-sh#21156)

Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: RiskyMH <git@riskymh.dev>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

bun-v1.2.18

Toggle bun-v1.2.18's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fixes oven-sh#20753 (oven-sh#20789)

Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>