Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package bun-pty for openSUSE:Factory checked in at 2026-10-27 16:48:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bun-pty (Old) and /work/SRC/openSUSE:Factory/.bun-pty.new.2252680 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bun-pty" Tue Oct 27 16:48:38 2026 rev:5 rq:1392807 version:0.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/bun-pty/bun-pty.changes 2026-10-15 16:12:56.560022511 +0200 +++ /work/SRC/openSUSE:Factory/.bun-pty.new.2252680/bun-pty.changes 2026-10-27 16:49:07.561899106 +0100 @@ -1,0 +2,12 @@ +Mon Oct 26 19:27:30 UTC 2026 - Martin Pluskal <[email protected]> + +- Update to version 0.5.2: + * spawn() reports a clear error naming the library path and the + cause when the native library fails to load, instead of + `undefined is not an object` (#51); importing without + spawning keeps working + * Linux ABI unchanged: same eight dlsym entry points, same + private librust_pty.so path; no consumer rebuild needed + * Refresh the vendored dependencies (libc 0.2.190 -> 0.2.191) + +------------------------------------------------------------------- Old: ---- bun-pty-0.5.1.tar.gz New: ---- bun-pty-0.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bun-pty.spec ++++++ --- /var/tmp/diff_new_pack.goE8I6/_old 2026-10-27 16:49:08.634944076 +0100 +++ /var/tmp/diff_new_pack.goE8I6/_new 2026-10-27 16:49:08.639944285 +0100 @@ -17,7 +17,7 @@ Name: bun-pty -Version: 0.5.1 +Version: 0.5.2 Release: 0 Summary: Pseudo-terminal library for Bun FFI consumers License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.goE8I6/_old 2026-10-27 16:49:08.697946716 +0100 +++ /var/tmp/diff_new_pack.goE8I6/_new 2026-10-27 16:49:08.704947009 +0100 @@ -1,6 +1,6 @@ <services> <service name="cargo_vendor" mode="manual"> - <param name="srctar">bun-pty-0.5.1.tar.gz</param> + <param name="srctar">bun-pty-0.5.2.tar.gz</param> <param name="cargotoml">rust-pty/Cargo.toml</param> <param name="compression">zst</param> </service> ++++++ bun-pty-0.5.1.tar.gz -> bun-pty-0.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bun-pty-0.5.1/CHANGELOG.md new/bun-pty-0.5.2/CHANGELOG.md --- old/bun-pty-0.5.1/CHANGELOG.md 2026-10-12 08:44:31.000000000 +0200 +++ new/bun-pty-0.5.2/CHANGELOG.md 2026-10-26 05:52:44.000000000 +0100 @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.2] - 2026-10-26 + +### Fixed +- When the native library fails to load, `spawn()` now throws an error naming the library path and the real cause, instead of `undefined is not an object (evaluating 'lib.symbols')` (#51) + - Importing bun-pty no longer throws when no library file is found either; the error is reported from `spawn()`, and the load failure is still logged at import + ## [0.5.1] - 2026-10-12 ### Fixed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bun-pty-0.5.1/package.json new/bun-pty-0.5.2/package.json --- old/bun-pty-0.5.1/package.json 2026-10-12 08:44:31.000000000 +0200 +++ new/bun-pty-0.5.2/package.json 2026-10-26 05:52:44.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "bun-pty", - "version": "0.5.1", + "version": "0.5.2", "description": "Cross-platform pseudoterminal (PTY) implementation for Bun with native performance", "main": "./src/index.ts", "types": "./dist/index.d.ts", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bun-pty-0.5.1/src/terminal.test.ts new/bun-pty-0.5.2/src/terminal.test.ts --- old/bun-pty-0.5.1/src/terminal.test.ts 2026-10-12 08:44:31.000000000 +0200 +++ new/bun-pty-0.5.2/src/terminal.test.ts 2026-10-26 05:52:44.000000000 +0100 @@ -1,4 +1,7 @@ import { expect, test, describe } from "bun:test"; +import { mkdtempSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; import { DEFAULT_COLS, DEFAULT_ROWS, DEFAULT_FILE, DEFAULT_NAME } from "./terminal"; import type { IPtyForkOptions, IExitEvent } from "./interfaces"; import { libraryFilenames } from "./library"; @@ -16,6 +19,31 @@ }); }); +describe("native library load failure", () => { + test("importing still works and spawn() reports the dlopen cause", async () => { + const notALibrary = join(mkdtempSync(join(tmpdir(), "bun-pty-")), "not-a-library.txt"); + writeFileSync(notALibrary, "not a shared library"); + const script = ` + const { Terminal } = await import(${JSON.stringify(join(import.meta.dir, "terminal.ts"))}); + try { new Terminal("sh"); console.log("spawned"); } + catch (e) { console.log(e instanceof TypeError ? "TypeError" : "Error", e.message.split("\\n")[0]); } + `; + const proc = Bun.spawn([process.execPath, "-e", script], { + env: { ...process.env, BUN_PTY_LIB: notALibrary }, + stdout: "pipe", + stderr: "pipe", + }); + const [stdout, exitCode] = await Promise.all([new Response(proc.stdout).text(), proc.exited]); + expect(exitCode).toBe(0); + const prefix = `Error bun-pty could not load its native library at ${notALibrary}: `; + const line = stdout.trim(); + expect(line.startsWith(prefix)).toBe(true); + const cause = line.slice(prefix.length); + expect(cause).not.toBe(""); + expect(cause).not.toBe("undefined"); + }); +}); + describe("Terminal configuration and options", () => { describe("default values", () => { test("should have correct default columns", () => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bun-pty-0.5.1/src/terminal.ts new/bun-pty-0.5.2/src/terminal.ts --- old/bun-pty-0.5.1/src/terminal.ts 2026-10-12 08:44:31.000000000 +0200 +++ new/bun-pty-0.5.2/src/terminal.ts 2026-10-26 05:52:44.000000000 +0100 @@ -111,13 +111,20 @@ ); } -const libPath = resolveLibPath(); +let libPath: string | undefined; // biome-ignore lint/suspicious/noExplicitAny: <explanation> let lib: any; +// Kept so a failed load can be reported from spawn() with the real cause. +let libLoadError: unknown; -// try to load the lib, if it fails log the error +// Load the native lib. We intentionally do not throw here: importing bun-pty +// without spawning (a bundler that bundles it, code paths that never open a +// terminal) must keep working. The failure is deferred to the constructor so it +// surfaces as a clear error from spawn() instead of +// "undefined is not an object (evaluating 'lib.symbols')" deep in a spawn. try { + libPath = resolveLibPath(); lib = dlopen(libPath, { bun_pty_spawn: { args: [FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.i32, FFIType.i32], @@ -141,7 +148,8 @@ bun_pty_close: { args: [FFIType.i32], returns: FFIType.void }, }); } catch (error) { - console.error("Failed to load lib", error); + libLoadError = error; + console.error("Failed to load bun-pty native library", error); } export class Terminal implements IPty { @@ -166,6 +174,13 @@ args: string[] = [], opts: IPtyForkOptions = {}, ) { + if (!lib) { + throw new Error( + `bun-pty could not load its native library${libPath ? ` at ${libPath}` : ""}: ${ + libLoadError instanceof Error ? libLoadError.message : String(libLoadError) + }`, + ); + } this._cols = opts.cols ?? DEFAULT_COLS; this._rows = opts.rows ?? DEFAULT_ROWS; const cwd = opts.cwd ?? process.cwd(); ++++++ vendor.tar.zst ++++++ ++++ 275349 lines of diff (skipped)
