Repository navigation
cask/macos: add undeletable container directories - #24357
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Container checks and coverage Library/Homebrew/cask/macos.rb, Library/Homebrew/test/cask/macos_spec.rb |
A private set defines three protected Library containers. undeletable? checks expanded and resolved path candidates for exact matches or containment. Specs check a login keychain path, a similarly named path under Keychains2, and an Applications child reached through a symlink. |
Priority:
Merge Risk: 
Minimal · up to d5b65
-
The protected directories are checked before uninstall deletion. No merge-blocking risk remains identified.
Pre-merge checks: 
4
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 1

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:
3afc3538-0b00-48b6-97f9-743be6eff8f6
Files selected for processing: 2-
Library/Homebrew/cask/macos.rbLibrary/Homebrew/test/cask/macos_spec.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks, looks good except Code Rabbit comment needs addressed!
9cc6fa1 to
844bd0c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1

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:
e48b33ae-f10e-4a60-b529-c347944f1b85
Files selected for processing: 2-
Library/Homebrew/cask/macos.rbLibrary/Homebrew/test/cask/macos_spec.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
|
@hyuraku will review again when all coderabbit comments addressed! |
844bd0c to
d5b65ad
Compare
MacOS.undeletable?only matches exact paths inUNDELETABLE_PATHS. So~/Library/Keychainsitself is protected, but a file inside it such as~/Library/Keychains/login.keychain-dbis not. Azap trash:oruninstall delete:stanza, or a pkg uninstall, could still remove it. There was aTODOasking for a way to protect everything under a directory.This change adds
UNDELETABLE_CONTAINERS.undeletable?now also returnstruefor these directories and any path under them. The list has three directories that are already inUNDELETABLE_PATHSand hold private user data:~/Library/Keychains(passwords and keys),~/Library/Messages(message history) and~/Library/Application Support/com.apple.TCC(privacy permissions).No official cask is affected as of 2026-10-26. None of the 7,814 casks in
homebrew/cask(at Homebrew/homebrew-cask@1d6a12f) point to a path under these directories. The new tests check a path inside~/Library/Keychainsand a sibling path (~/Library/Keychains2/...) to make sure the prefix match does not catch the sibling.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?AI (Claude Code) assisted in writing the code and tests, and searched
homebrew/caskfor affected casks. I reviewed the change and ranbrew lgtmlocally.