Skip to content

bun: 1.3.11 -> 1.3.13#508770

Merged
mdaniels5757 merged 1 commit into
NixOS:masterfrom
delafthi:delafthi/kwpozkrtymyn
May 3, 2026
Merged

bun: 1.3.11 -> 1.3.13#508770
mdaniels5757 merged 1 commit into
NixOS:masterfrom
delafthi:delafthi/kwpozkrtymyn

Conversation

@delafthi
Copy link
Copy Markdown
Contributor

@delafthi delafthi commented Apr 10, 2026

https://bun.sh/blog/bun-v1.3.12
https://bun.sh/blog/bun-v1.3.13

Blocked due to oven-sh/bun#29290. I'll proceed when the fix drops in the new release.

Resolves #512300

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (update) This PR updates a package to a newer version 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Apr 10, 2026
@delafthi

This comment was marked as outdated.

@delafthi
Copy link
Copy Markdown
Contributor Author

I'll look into the build issues. Especially, with opencode.

@etinquis
Copy link
Copy Markdown

FYI (in case it may be relevant) I've opened oven-sh/bun#29290 because I'm not getting runnable executables out of bun build --compile in 1.3.12.

@delafthi
Copy link
Copy Markdown
Contributor Author

@etinquis thanks, for opening this. I'll make this PR a draft - let's wait for the next release.

@delafthi delafthi marked this pull request as draft April 15, 2026 13:06
@delafthi delafthi changed the title bun: 1.3.11 -> 1.3.12 bun: 1.3.11 -> 1.3.13 Apr 20, 2026
@delafthi delafthi force-pushed the delafthi/kwpozkrtymyn branch from 91cfbb3 to 9dd5558 Compare April 20, 2026 11:13
@delafthi
Copy link
Copy Markdown
Contributor Author

Version 1.3.13 dropped. I'll proceed - nixpkgs-review is running. I'll undraft this PR if the results look good.

@delafthi
Copy link
Copy Markdown
Contributor Author

nixpks-review-gha is unable to finish the build for aarch64-linux. So, I'm pasting the results for the other platforms manually:

aarch64-darwin

2026-04-20T12:48:18.8883400Z ✅ 10 packages built:
  • atuin-desktop
  • bun
  • duplicati
  • filen-cli
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev
  • opencode
  • opencode-desktop

x86_64-darwin

✅ 7 packages built:
  • atuin-desktop
  • duplicati
  • filen-cli
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev

x86_64-linux

❌ 2 packages failed to build:
  • gitlab-duo
  • swagger-typescript-api
✅ 15 packages built:
  • atuin-desktop
  • balatro-mod-manager
  • bun
  • convertx
  • duplicati
  • equibop
  • filen-cli
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev
  • opencode
  • opencode-desktop
  • surrealist
  • windmill

Error logs: `x86_64-linux`
gitlab-duo
shrinking RPATHs of ELF executables and libraries in /nix/store/apswddqpzvfxq75pqj0kf0p440f3vfrh-gitlab-duo-8.67.0
shrinking /nix/store/apswddqpzvfxq75pqj0kf0p440f3vfrh-gitlab-duo-8.67.0/bin/duo
checking for references to /build/ in /nix/store/apswddqpzvfxq75pqj0kf0p440f3vfrh-gitlab-duo-8.67.0...
patching script interpreter paths in /nix/store/apswddqpzvfxq75pqj0kf0p440f3vfrh-gitlab-duo-8.67.0
Running phase: installCheckPhase
@nix { "action": "setPhase", "phase": "installCheckPhase" }
Executing versionCheckPhase
Did not find version 8.67.0 in the output of the command /nix/store/apswddqpzvfxq75pqj0kf0p440f3vfrh-gitlab-duo-8.67.0/bin/duo --version
323003 |   }
323004 |   enhanceDscWithOpenTelemetryRootSpanName(client);
323005 |   setupEventContextTrace(client);
323006 |   return client;
323007 | }
323008 | function validateOpenTelemetrySetup() {
         ^
SyntaxError: Cannot declare a function that shadows a let/const/class/function variable '_init'.
      at <parse> (/$bunfs/root/duo-linux-x64:323008:1)
      at native:11:43

Bun v1.3.13 (Linux x64)

@delafthi delafthi marked this pull request as ready for review April 22, 2026 15:14
maximousblk added a commit to maximousblk/nyx that referenced this pull request Apr 26, 2026
- Drop prettier substitutions fixed upstream [1]
- Replace TS source patch with package.json packageManager pin [2]

[1]: anomalyco/opencode#23255
[2]: NixOS/nixpkgs#508770
@mdaniels5757
Copy link
Copy Markdown
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 508770
Commit: 9dd5558b06dbdacbf635a3dd36dce1b1a7ee3a89


x86_64-linux

✅ 17 packages built:
  • atuin-desktop
  • balatro-mod-manager
  • bun
  • convertx
  • duplicati
  • equibop
  • filen-cli
  • gitlab-duo
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev
  • opencode
  • opencode-desktop
  • surrealist
  • swagger-typescript-api
  • windmill

aarch64-linux

❌ 1 package failed to build:
  • balatro-mod-manager
✅ 15 packages built:
  • atuin-desktop
  • bun
  • convertx
  • duplicati
  • equibop
  • filen-cli
  • gitlab-duo
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev
  • opencode
  • opencode-desktop
  • surrealist
  • windmill

x86_64-darwin

✅ 7 packages built:
  • atuin-desktop
  • duplicati
  • filen-cli
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev

aarch64-darwin

✅ 10 packages built:
  • atuin-desktop
  • bun
  • duplicati
  • filen-cli
  • gleam
  • gowebly
  • home-assistant-custom-lovelace-modules.navbar-card
  • models-dev
  • opencode
  • opencode-desktop

Error logs: `aarch64-linux`
balatro-mod-manager
  Require stack:
  - /build/source/node_modules/rollup/dist/native.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
      at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
      at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
      at Module._load (node:internal/modules/cjs/loader:1242:25)
      at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
      at Module.require (node:internal/modules/cjs/loader:1556:12)
      at require (node:internal/modules/helpers:152:16)
      at requireWithFriendlyError (/build/source/node_modules/rollup/dist/native.js:46:10)
      at Object.<anonymous> (/build/source/node_modules/rollup/dist/native.js:73:76)
      at Module._compile (node:internal/modules/cjs/loader:1812:14) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/build/source/node_modules/rollup/dist/native.js' ]
  }
}

Node.js v24.14.1
error: script "build" exited with code 1
Error beforeBuildCommand bun run build failed with exit code 1

@mdaniels5757 mdaniels5757 added this pull request to the merge queue May 3, 2026
Merged via the queue into NixOS:master with commit ede7a04 May 3, 2026
30 of 32 checks passed
@delafthi delafthi deleted the delafthi/kwpozkrtymyn branch May 3, 2026 19:37
@terlar
Copy link
Copy Markdown
Contributor

terlar commented May 8, 2026

After this change, opencode refuses to launch on at least two WSL machines:

Bisecting: 1 revision left to test after this (roughly 1 step)
[ede7a04c7ae52bfc797a963f6bcf82bc56ed760f] bun: 1.3.11 -> 1.3.13 (#508770)
$ nix run .#opencode -- --version
fish: Job 1, '/nix/store/7i4bcskcq8mvdm4hqygy…' terminated by signal SIGSEGV (Address boundary error)

Not sure exactly why.

@terlar
Copy link
Copy Markdown
Contributor

terlar commented May 8, 2026

I used AI to look into this issue and this was the conclusion:

Root cause: bun 1.3.12's new ELF section approach broke the BSS mapping in the compiled binary.
The sequence:
1. bun 1.3.12 changed bun build --compile to embed the app bundle as a real ELF PT_LOAD section (.bun) instead of reading from /proc/self/exe. The .bun section is placed at VMA 0x6511000 — higher than the data+BSS segment.
2. The Linux kernel's ELF loader (load_elf_binary in fs/binfmt_elf.c) computes the BSS region as a single contiguous range using the maximum p_vaddr + p_memsz across all PT_LOAD segments. With .bun dominating at 0xa7a8000, the kernel calls set_brk(0xa7a8000, 0xa7a8000, ...) — which is a no-op since start == end.
3. The data segment's BSS (0x6427000–0x6511000, ~11MB) is never mapped. The kernel only file-mapped 0x6390000–0x6427000.
4. The dynamic linker (_dl_relocate_object_no_relro) tries to apply relocations to pointer slots in the BSS, hits the unmapped page at 0x6510e40, and crashes with SIGSEGV SEGV_MAPERR.
bun 1.3.13 fixed one symptom on NixOS (interpreter path rewrite), but the underlying BSS mapping issue remains — and it manifests here on WSL2.
The fix options:
1. Proper fix (upstream bun): The .bun PT_LOAD segment needs to be placed at a VMA lower than the data+BSS segment, or the kernel ELF loader needs to be taught to handle multiple BSS regions. This is a bun bug to report.
2. Workaround in nixpkgs: Pin bun to 1.3.11 for the opencode build using the corrected overlay from my earlier response — that way bun build --compile uses the old /proc/self/exe approach, which doesn't add the extra PT_LOAD and doesn't corrupt the BSS layout.
3. Post-build binary patch: After building, use patchelf or a custom script to reorder the PT_LOAD segments so .bun comes last, letting the kernel properly map the data segment's BSS. But this is fragile.
The overlay downgrade to bun 1.3.11 is the most practical fix for nixpkgs right now, and the bun issue should be reported upstream.

I currently use the following override:

(final: prev: {
  opencode = prev.opencode.override {
    bun = prev.bun.overrideAttrs (
      old:
      let
        version = "1.3.11";
        sources = {
          "aarch64-darwin" = final.fetchurl {
            url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-darwin-aarch64.zip";
            hash = "sha256-b1o0Z+2crsR5W/eM1HZQfZ+HDH1XuGyUX8szgSZ3L/w=";
          };
          "aarch64-linux" = final.fetchurl {
            url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-aarch64.zip";
            hash = "sha256-0TlE2hKlPsx0v2pyC9HQTEVVwDjf5CI2U1anvkdpH98=";
          };
          "x86_64-darwin" = final.fetchurl {
            url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-darwin-x64-baseline.zip";
            hash = "sha256-+2c5sIv1RVDtqnyCTNWy3KRbagav70CEQwh6YxBfb40=";
          };
          "x86_64-linux" = final.fetchurl {
            url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-x64.zip";
            hash = "sha256-hhG6k1r4hvBabzh0ChUWAybBXl1dB63vlmEwtEk2B+0=";
          };
        };
      in
      {
        inherit version;
        src = sources.${final.stdenvNoCC.hostPlatform.system};
        passthru = old.passthru // {
          inherit sources;
        };
      }
    );
  };
})

@terlar
Copy link
Copy Markdown
Contributor

terlar commented May 8, 2026

Seems there is a fix for this upstream oven-sh/bun#29967

So hopefully it is just a matter of time...

@delafthi
Copy link
Copy Markdown
Contributor Author

delafthi commented May 9, 2026

@terlar thanks, for the investigation. Let's hope the new release drops soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (update) This PR updates a package to a newer version 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Request: bun 1.3.11 → 1.3.13

5 participants