Skip to content

Hide dup3() and pipe2() from configure on macOS older than 27 - #2641

Merged
hsbt merged 1 commit into
masterfrom
claude/ruby-build-2640-patch-607d0a
Sep 16, 2026
Merged

hsbt merged 1 commit into
masterfrom
claude/ruby-build-2640-patch-607d0a

Conversation

@hsbt

@hsbt hsbt commented Sep 16, 2026

Copy link
Copy Markdown
Member

The macOS 27 SDK declares dup3() and pipe2() as available since macOS 27.0. AC_CHECK_FUNCS links them without including the header, so HAVE_DUP3 and HAVE_PIPE2 get defined even when the deployment target is older, and the weakly linked symbols are NULL at runtime. miniruby then segfaults while generating builtin_binary.rbbin, which breaks every released Ruby on macOS 26 with the Command Line Tools 27.

Exporting ac_cv_func_dup3=no and ac_cv_func_pipe2=no on build hosts older than macOS 27 restores what the macOS 26 SDK produced. io.c is the only user of either function and neither is callable on macOS 26, so nothing is lost. Upstream added a runtime availability check in ruby/ruby@6bfde8d, but the already released tarballs stay broken.

Verified by installing 4.0.7 through ruby-build with sw_vers reporting 26.6.2. The build completes, the installed config.h has neither macro, and IO.pipe, IO#close_on_exec? and IO.popen all behave.

Fixes #2640
https://bugs.ruby-lang.org/issues/22311

Generated with Claude Code

The macOS 27 SDK declares both as available since macOS 27.0, and
`AC_CHECK_FUNCS` detects them regardless of the deployment target, so
Ruby built on macOS 26 with the Command Line Tools 27 calls weakly
linked NULL symbols and crashes miniruby during the build.

https://bugs.ruby-lang.org/issues/22311
#2640

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hsbt
hsbt merged commit 9072838 into master Sep 16, 2026
6 checks passed
@hsbt
hsbt deleted the claude/ruby-build-2640-patch-607d0a branch September 16, 2026 00:48
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
ruby-build 20260916

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* Set -x flag for release script to show commands being run by @eregon in rbenv/ruby-build#2639
* Hide dup3() and pipe2() from configure on macOS older than 27 by @hsbt in rbenv/ruby-build#2641


**Full Changelog**: https://github.com/rbenv/ruby-build/compare/v20260915...v20260916</pre>
  <p>View the full release notes at <a href="https://github.com/rbenv/ruby-build/releases/tag/v20260916">https://github.com/rbenv/ruby-build/releases/tag/v20260916</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!20421
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.

Latest CLT on macOS cannot link ruby

1 participant