Avoid generated rmdir for shared file lists#22940
Conversation
Do not derive rmdir candidates for Apple's application recent documents directory when generate-zap finds matching shared file list files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adjusts brew generate-zap to avoid generating rmdir directives for macOS-owned Shared File List “ApplicationRecentDocuments” directories, which can contain state for multiple applications and should not be removed as part of an app-specific zap stanza.
Changes:
- Add the Shared File List “ApplicationRecentDocuments” directory to the
rmdirexclusion list used when derivingrmdircandidates. - Add a regression spec ensuring
derive_rmdir_candidatesdoes not suggestrmdirfor app-specific.sfl*files under that shared directory.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/dev-cmd/generate-zap.rb | Excludes the macOS-owned Shared File List recent-documents directory from derived rmdir candidates. |
| Library/Homebrew/test/dev-cmd/generate-zap_spec.rb | Adds a regression test to ensure no rmdir is suggested for that shared recent-documents directory. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Low
|
Thanks for the PR @loganrosen - I don't disagree with making this change, because it doesn't make sense for this to be included in the From a philosophical point of view, it it is worth noting the I have a specific comment on the test itself, but I'll leave that against the actual code for context. |
Assert the generated rmdir candidates exclude the shared recent documents directory itself, rather than only checking the enclosed app-specific file path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?GitHub Copilot CLI helped make this small change. I verified it with the new regression test,
./bin/brew lgtm --online, and./bin/brew generate-zap transmission.This prevents
brew generate-zapfrom suggestingrmdirfor Apple's shared recent documents directory when it finds an app-specific.sfl*file under that directory.For example, before this change, running:
could suggest removing:
zap rmdironly removes directories if they are empty, so this would not removeother applications' shared file list entries.
However, this parent directory is macOS-owned and not app-specific, so including
it in generated cask-specific zap stanzas is misleading noise.
The matching app-specific shared file list file is already included under
trash.This adds that directory to the generated
rmdirexclusions and adds a regression test for the derivedrmdircandidates../bin/brew lgtm --onlinepasses locally.