fix: homebrew cask postflight xattr references wrong binary name#2899
Merged
markphelps merged 1 commit intomainfrom Apr 1, 2026
Merged
fix: homebrew cask postflight xattr references wrong binary name#2899markphelps merged 1 commit intomainfrom
markphelps merged 1 commit intomainfrom
Conversation
The postflight block ran xattr on staged_path/cog, but the actual binary in the staged directory is named cog_Darwin_arm64 or cog_Darwin_x86_64. The binary stanza only creates a symlink -- it doesn't rename the source. Fix by constructing the correct filename using Hardware::CPU.arm? in the postflight block. Also extract the inline cask heredoc into a standalone .github/cog.rb.tmpl template file. This makes the cask easier to read, edit, and diff. The workflow now uses envsubst with an explicit variable list to substitute only the shell placeholders while preserving Ruby interpolation.
|
I'm Bonk, and I've done a quick review of your PR. This PR fixes the Homebrew cask postflight One issue with indentation consistency in the template: cat > /tmp/review.json << 'REVIEW'
{
"event": "COMMENT",
"body": "This PR correctly fixes the `xattr` command in the Homebrew cask postflight to reference the actual binary filename (`cog_Darwin_arm64` or `cog_Darwin_x86_64`) instead of the non-existent `cog` in the staged path.\n\nOne minor formatting suggestion for better readability in the template.",
"comments": [
{
"path": ".github/cog.rb.tmpl",
"start_line": 21,
"line": 26,
"side": "RIGHT",
"body": "The indentation is inconsistent here - the `on_intel` block content is at a different level than `on_arm`. For better readability and to match standard Ruby formatting:\n\n```suggestion\n binary \"cog_Darwin_#{on_intel do\n \\\"x86_64\\\"\n end\n on_arm do\n \\\"arm64\\\"\n end}\", target: \"cog\"\n```\n\nAlternatively, consider using a more compact form:\n```ruby\n binary \"cog_Darwin_#{Hardware::CPU.arm? ? \\\"arm64\\\" : \\\"x86_64\\\"}\", target: \"cog\"\n```\n\nThis would be consistent with how the `postflight` block handles the architecture detection."
}
]
}
REVIEW
gh api repos/replicate/cog/pulls/2899/reviews --input /tmp/review.json |
michaeldwan
approved these changes
Apr 1, 2026
markphelps
added a commit
that referenced
this pull request
Apr 8, 2026
…icate/cog into mphelps/push-phase-progress * 'mphelps/push-phase-progress' of https://github.com/replicate/cog: (95 commits) feat: add metric name validation (#2911) Rename `cog run` to `cog exec` (#2916) chore(deps): bump github.com/google/go-containerregistry (#2884) fix: replace removed libgl1-mesa-glx in tensorflow integration test (#2914) ci: enforce stub freshness in CI, fix existing stub drift (#2912) feat: add schema-compare command to test harness (#2891) chore(deps): bump uuid from 1.22.0 to 1.23.0 in /crates (#2887) chore(deps): bump github.com/hashicorp/go-version from 1.7.0 to 1.9.0 (#2909) chore(deps): bump insta from 1.46.3 to 1.47.2 in /crates (#2908) fix: support list[X] | None inputs + integration tests for PEP 604 union File/Path coercion (#2882) ci: exclude Dependabot PRs from auto-code review (#2910) chore(deps): bump actions/checkout from 4 to 6 (#2904) chore(deps): bump github.com/testcontainers/testcontainers-go/modules/registry (#2886) fix: metrics bugs in coglet prediction server (#2896) Bump version to 0.17.2 (#2903) fix(coglet): propagate metric scope to async event loop thread (#2902) chore: remove unnecessary nolint directive in test (#2803) feat(coglet): add Sentry error reporting for infrastructure errors (#2865) fix: homebrew cask postflight xattr references wrong binary name (#2899) fix: include custom metrics in cog predict --json output (#2897) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
brew install --cask replicate/tap/cogfailing withxattr: No such fileduring postflight.github/cog.rb.tmpltemplate fileProblem
The
postflightblock runsxattr -dr com.apple.quarantineon#{staged_path}/cog, but the downloaded binary is namedcog_Darwin_arm64(orcog_Darwin_x86_64) in the staged directory. Thebinarystanza creates a symlink with the target namecogin/opt/homebrew/bin/, but does not rename the file in the staged path.Corresponds to replicate/homebrew-tap#32
Fix
Use
Hardware::CPU.arm?to construct the correct binary filename in thepostflightblock, matching the actual file in the staged directory.Template extraction
The inline heredoc +
sedsubstitution was fragile and hard to read. The cask is now a standalone template at.github/cog.rb.tmplwithenvsubstdoing variable substitution:.rb.tmplfile looks like the actual Ruby cask -- readable, diffable, syntax-highlightableenvsubstwith an explicit variable list ('${VERSION} ${SHA_ARM} ${SHA_X86}') only substitutes shell placeholders while preserving Ruby#{...}interpolationactions/checkout(sparse) to get the template, then downloads checksums