Skip to content

Fix Dup2 usage#415

Merged
canercidam merged 1 commit intomainfrom
caner/fix-build-syscall-dup
Apr 22, 2026
Merged

Fix Dup2 usage#415
canercidam merged 1 commit intomainfrom
caner/fix-build-syscall-dup

Conversation

@canercidam
Copy link
Copy Markdown
Member

This fixes the linux/arm64 build.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 22, 2026

Claude finished @canercidam's task in 50s —— View job


PR Review

Scope: Replaces syscall.Dup2 with unix.Dup2 in utils/detached.go to fix the linux/arm64 build, and promotes golang.org/x/sys from indirect to direct in go.mod.

Assessment: The fix is correct and minimal.

  • syscall.Dup2 is not defined on linux/arm64 (and riscv64, loong64) because the kernel does not expose the dup2 syscall there — only dup3. golang.org/x/sys/unix.Dup2 papers over this by calling Dup3(oldfd, newfd, 0) on those architectures, so the behavior is equivalent on the architectures that already worked, and it now compiles on arm64.
  • Moving golang.org/x/sys from indirect to direct is the right hygiene since it's now imported directly.
  • One minor semantic difference worth being aware of (not a blocker here): on arm64-style builds, unix.Dup2 dispatches through Dup3, which returns EINVAL when oldfd == newfd (whereas dup2 is a no-op in that case). The three call sites here dup a freshly-opened fd onto 0/1/2, so they can't collide — no action needed, just flagging.
  • No build tag on utils/detached.go, but the file already uses SysProcAttr{Setsid: true} etc., so it was implicitly Unix-only before this PR and remains so.

Nothing that needs attention.
caner/fix-build-syscall-dup

@canercidam canercidam merged commit b2a20ce into main Apr 22, 2026
7 checks passed
@canercidam canercidam deleted the caner/fix-build-syscall-dup branch April 22, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant