From 5fabeb4bd57ce44fae1a99c36c62b3b4d367b679 Mon Sep 17 00:00:00 2001 From: Ian Duffy Date: Fri, 31 Jul 2026 15:46:37 +0100 Subject: [PATCH] fix(ENG-13692): stop Homebrew rewriting bundled dylib IDs on macOS Since 1.20.1 the Homebrew formula ships the PyInstaller onedir bundle, so the keg contains 65 prebuilt Mach-O files where the zipapp had none. Homebrew rewrites the dylib ID of every one of them to an absolute Cellar path, and that name does not fit in the header padding of pydantic_core's prebuilt wheel: Failed changing dylib ID of .../_pydantic_core.cpython-312-darwin.so from @rpath/pydantic_core._pydantic_core.cpython-312-darwin.so to /opt/homebrew/opt/cloudsmith-cli/libexec/_internal/... Error: Failed to fix install linkage The install still links and the CLI runs, but brew exits non-zero, which breaks `brew upgrade` and the automation around it. Both macOS architectures are affected; the Intel bundle has less padding to spare (32 bytes against the 56 the new name needs, versus 48 on arm64). Rewriting these IDs achieves nothing: every non-system linkage in the bundle is @rpath-relative and private to it, and nothing outside links against them. Homebrew already skips @rpath install names and rpaths; the dylib ID is the one path lacking that exemption, and preserve_rpath supplies it. The tap carries this fix already (cloudsmith-io/homebrew-cloudsmith-cli#28), but publish-homebrew copies the rendered template over Formula/cloudsmith-cli.rb wholesale, so without the same change here the next release would silently revert it. Rendered with 1.20.2's values this template now produces a formula byte-identical to the tap's, and brew style and brew audit both pass. Co-Authored-By: Claude Opus 5 (1M context) --- packaging/homebrew/cloudsmith-cli.rb.tmpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/homebrew/cloudsmith-cli.rb.tmpl b/packaging/homebrew/cloudsmith-cli.rb.tmpl index b2f2b7b8..66435157 100644 --- a/packaging/homebrew/cloudsmith-cli.rb.tmpl +++ b/packaging/homebrew/cloudsmith-cli.rb.tmpl @@ -30,6 +30,12 @@ class CloudsmithCli < Formula regex(/^version=(\d+(?:\.\d+)+)$/i) end + # The bundled libraries are private to the PyInstaller bundle and are resolved + # via @rpath, so Homebrew must not rewrite their dylib IDs: the absolute Cellar + # path does not fit in the Mach-O header padding of prebuilt wheels such as + # pydantic_core, which fails the install. + preserve_rpath + def install # PyInstaller onedir bundle: the executable must stay next to _internal/. libexec.install Dir["*"]