From 2aa7a4b4d8c2a9b7f3b4b206e4c30d38b157f394 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Mon, 18 May 2026 14:39:07 +0000 Subject: [PATCH 1/4] wtf-bindings: use WTF ASSERT() in uv__tty_make_raw The libc assert() here relied on being pulled in transitively by a WebKit header. After the WebKit upgrade in #30705 that include is gone, so debug builds fail on the unified-source unit that contains wtf-bindings.cpp: src/jsc/bindings/wtf-bindings.cpp:64:5: error: use of undeclared identifier 'assert' ASSERT() is the WTF-style assertion used elsewhere in the same file and does not depend on a libc header being in scope. Release builds were unaffected because the unified grouping happened to still pull cassert in there. Fixes #30988 --- src/jsc/bindings/wtf-bindings.cpp | 2 +- test/js/bun/terminal/terminal.test.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/jsc/bindings/wtf-bindings.cpp b/src/jsc/bindings/wtf-bindings.cpp index 0d4968f805f..8b09b5a8665 100644 --- a/src/jsc/bindings/wtf-bindings.cpp +++ b/src/jsc/bindings/wtf-bindings.cpp @@ -61,7 +61,7 @@ extern "C" int uv_tty_reset_mode(void) static void uv__tty_make_raw(struct termios* tio) { - assert(tio != NULL); + ASSERT(tio != NULL); #if defined __sun || defined __MVS__ /* diff --git a/test/js/bun/terminal/terminal.test.ts b/test/js/bun/terminal/terminal.test.ts index 0d7609d100d..7b26e0a0b2e 100644 --- a/test/js/bun/terminal/terminal.test.ts +++ b/test/js/bun/terminal/terminal.test.ts @@ -278,6 +278,32 @@ describe("Bun.Terminal", () => { expect(() => terminal.setRawMode(true)).toThrow("Terminal is closed"); }); + + // Regression for #30988: wtf-bindings.cpp used libc `assert` without + // including . After the WebKit upgrade in #30705 the header + // stopped reaching this translation unit transitively, so debug builds + // failed to compile. Building and running this test file exercises + // Bun__ttySetMode (the same translation unit) on a real PTY fd and + // proves the file compiled. + test.skipIf(isWindows)("setRawMode toggles on a real PTY fd", async () => { + await using terminal = new Bun.Terminal({}); + const ICANON = 0x2; + const ECHO = 0x8; + + const beforeLflag = terminal.localFlags; + expect(beforeLflag & ICANON).not.toBe(0); + expect(beforeLflag & ECHO).not.toBe(0); + + terminal.setRawMode(true); + const rawLflag = terminal.localFlags; + expect(rawLflag & ICANON).toBe(0); + expect(rawLflag & ECHO).toBe(0); + + terminal.setRawMode(false); + const restoredLflag = terminal.localFlags; + expect(restoredLflag & ICANON).not.toBe(0); + expect(restoredLflag & ECHO).not.toBe(0); + }); }); describe("termios flags", () => { From 4262bbc32a888be4329c76f3b2c092f98b000a19 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Mon, 18 May 2026 15:03:08 +0000 Subject: [PATCH 2/4] terminal.test: pick ICANON per-platform (0x100 on darwin) ICANON is 0x2 on Linux/BSD but 0x100 on Darwin (bit 0x2 is ECHOE on macOS, which Bun__ttySetMode mode=1 does not clear). Match the style already used in terminal-spawn.test.ts so macOS CI doesn't fail the new PTY-fd regression test. --- test/js/bun/terminal/terminal.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/js/bun/terminal/terminal.test.ts b/test/js/bun/terminal/terminal.test.ts index 7b26e0a0b2e..e60f5925f15 100644 --- a/test/js/bun/terminal/terminal.test.ts +++ b/test/js/bun/terminal/terminal.test.ts @@ -287,7 +287,10 @@ describe("Bun.Terminal", () => { // proves the file compiled. test.skipIf(isWindows)("setRawMode toggles on a real PTY fd", async () => { await using terminal = new Bun.Terminal({}); - const ICANON = 0x2; + // ICANON is 0x2 on Linux/BSD but 0x100 on Darwin (bit 0x2 is ECHOE there, + // which Bun__ttySetMode mode=1 does not clear, so a flat 0x2 would fail + // on macOS CI). ECHO is 0x8 on every POSIX we build for. + const ICANON = process.platform === "darwin" ? 0x100 : 0x2; const ECHO = 0x8; const beforeLflag = terminal.localFlags; From 77974b976f79fc206adaed43df1c1340f78af484 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Mon, 18 May 2026 15:21:49 +0000 Subject: [PATCH 3/4] terminal.test: drop stray BSD from ICANON comment --- test/js/bun/terminal/terminal.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/js/bun/terminal/terminal.test.ts b/test/js/bun/terminal/terminal.test.ts index e60f5925f15..65c78a2d272 100644 --- a/test/js/bun/terminal/terminal.test.ts +++ b/test/js/bun/terminal/terminal.test.ts @@ -287,9 +287,9 @@ describe("Bun.Terminal", () => { // proves the file compiled. test.skipIf(isWindows)("setRawMode toggles on a real PTY fd", async () => { await using terminal = new Bun.Terminal({}); - // ICANON is 0x2 on Linux/BSD but 0x100 on Darwin (bit 0x2 is ECHOE there, + // ICANON is 0x2 on Linux but 0x100 on Darwin — bit 0x2 is ECHOE there, // which Bun__ttySetMode mode=1 does not clear, so a flat 0x2 would fail - // on macOS CI). ECHO is 0x8 on every POSIX we build for. + // on macOS CI. ECHO is 0x8 on every POSIX we build for. const ICANON = process.platform === "darwin" ? 0x100 : 0x2; const ECHO = 0x8; From 491196331d4dd3c584ff7bbf1f776815643d7359 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Mon, 18 May 2026 17:06:19 +0000 Subject: [PATCH 4/4] ci: retrigger (darwin-14-aarch64 expired in queue)