Skip to content

cask/dsl: store lone intel and x86_64 sha256 - #24517

Merged
MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
dduugg:cask-sha256-single-arch
Nov 7, 2026
Merged

MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
dduugg:cask-sha256-single-arch

Conversation

@dduugg

@dduugg dduugg commented Nov 6, 2026

Copy link
Copy Markdown
Member
  • Fix sha256 dropping a checksum given only as intel: or x86_64:, which left cask.sha256 as nil and made brew audit report a sha256 stanza is required.
  • Use && instead of || in the check that decides whether sha256 is being read or set.
  • Add examples for a lone intel: checksum and a lone x86_64: checksum.
  • Reproduce with brew ruby -e 'Homebrew::SimulateSystem.with(os: :macos, arch: :intel) { p Cask::Cask.new("foo") { sha256 intel: "a" * 64 }.sha256 }', which prints nil before the fix.
  • Found by a scan of the repo for methods that misread which arguments were passed, the shape of the bug fixed in formula_installer: keep unlinked kegs unlinked #24514. It is the only other defect the scan found.

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Code with Sonnet 5.5 and Opus 5.5, with local review and testing.


- `sha256` treated a call with only `intel:` or only `x86_64:` as a
  getter because the check used `||` instead of `&&`
- the checksum was dropped silently and `cask.sha256` stayed `nil`
- add examples for both keywords
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Corrected how architecture-specific checksums are selected for Intel Macs when a cask specifies a checksum for only one architecture.

The sha256 DSL now treats an intel checksum as an assignment argument. Tests cover single-architecture intel and x86_64 checksums under simulated Intel macOS.

Changes: sha256 DSL

Layer / File(s) Summary
Checksum assignment detection
Library/Homebrew/cask/dsl.rb, Library/Homebrew/test/cask/dsl_spec.rb
The sha256 DSL treats a supplied intel checksum as an assignment argument. Tests check the returned checksum when only intel or only x86_64 is supplied.
Merge Risk: Minimal · up to 0daaa

No merge-blocking issue was identified. Run the normal checks before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title identifies the fix for lone intel and x86_64 checksums.
Description check Passed The description explains the checksum handling fix and the tests for both single-keyword cases.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 14634b63-738e-4b94-b48a-7e8949e67c21
Commits

Reviewing files that changed from the base of the PR and between 88f401f and 0daaa18.

Files selected for processing: 2

  • Library/Homebrew/cask/dsl.rb
  • Library/Homebrew/test/cask/dsl_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Nov 7, 2026
Merged via the queue into Homebrew:main with commit 3981afa Nov 7, 2026
55 checks passed
@dduugg
dduugg deleted the cask-sha256-single-arch branch November 10, 2026 20:06
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.

2 participants

⌂ 换网址