Skip to content

fix(bootstrap): skip volume metadata when extracting DMGs - #13378

Merged
jdx merged 1 commit into
mainfrom
fix/dmg-skip-volume-metadata
Sep 19, 2026
Merged

jdx merged 1 commit into
mainfrom
fix/dmg-skip-volume-metadata

Conversation

@jdx

@jdx jdx commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

https://entire.io/gh/jdx/mise/trails/31

Installing a cask whose DMG has unreadable volume metadata at its root failed partway through extraction. mysqlworkbench is one example: its image ships .Trashes with mode 0333 (no read bit for anyone), so:

[bootstrap.packages]
"brew-cask:mysqlworkbench" = "latest"
$ mise bootstrap packages apply brew-cask:mysqlworkbench
INFO  brew-cask:mysqlworkbench ✗ failed
Error:
   0: IO error for operation on /var/folders/.../T/.tmpZxYkK9/.Trashes: Permission denied (os error 13)

un_dmg mounted the image and copied the entire volume. Metadata such as .Trashes, .fseventsd, .DS_Store and .background was included, and the copy failed on the first entry it couldn't read. DMG extraction now skips these entries at the volume root and copies everything else as before. The skip list is Homebrew's DMG_METADATA list, the same one brew install --cask uses, so the cask installs.

The same extraction code is used for aqua tools distributed as DMGs and for DMGs nested inside other cask archives, so both get the fix. Entries with these names deeper in the image, such as inside an .app bundle, are still copied.

Reported in #13361.

Validation

  • A new unit test builds a volume with a mode-0333 .Trashes and other metadata, and checks that the copy succeeds and that only root-level metadata is dropped. With the skip list removed, the test fails with the reporter's Permission denied (os error 13).
  • cargo test --bin mise file::tests (187 passed), clippy with -D warnings, and mise run lint pass.
  • Not run on macOS against a real DMG; hdiutil isn't available in this Linux environment.

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.275.

🤖 Generated with Claude Code


Note

Low Risk
Targeted change to DMG copy behavior on macOS; aligns with Homebrew cask handling and only omits known root-level metadata, with a regression test for the permission-denied case.

Overview
DMG extraction no longer fails when macOS volume metadata at the image root is unreadable (e.g. .Trashes with mode 0333 on mysqlworkbench).

un_dmg now copies the mounted volume through copy_dmg_volume, which skips only top-level names from Homebrew’s DMG_METADATA list (.Trashes, .DS_Store, .fseventsd, etc.) instead of walking the entire volume. Symlink-preserving directory copy gained an internal copy_dir_all_preserve_symlinks_skipping helper that uses WalkDir::filter_entry so those roots are never descended into; normal copy_dir_all_preserve_symlinks behavior is unchanged (empty skip list).

Same-named paths inside app bundles or other subtrees are still copied. A unix unit test simulates mode-0333 .Trashes and asserts metadata is omitted while real payload (including nested .Trashes) remains.

Reviewed by Cursor Bugbot for commit 4f47dba. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • DMG extraction now excludes volume metadata files while preserving other contents.
    • Improved handling of symbolic links during directory copying.

Mounted DMGs carry volume metadata at their root, and some of it is
unreadable: mysql-workbench-community-8.0.47 ships `.Trashes` with mode
0333, which made the copy out of the mount fail with EACCES. Skip
Homebrew's DMG_METADATA names at the volume root, as `brew` does.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 0448cc09-8cf4-445e-bbf1-06b1310764d2

📥 Commits

Reviewing files that changed from the base of the PR and between 914a9cf and 4f47dba.

📒 Files selected for processing (1)
  • src/file.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Changes

DMG metadata filtering

Layer / File(s) Summary
Top-level copy filtering
src/file.rs
Adds a private helper that skips selected depth-1 entries during directory copying.
DMG extraction integration and validation
src/file.rs
Defines DMG metadata entries, uses the filtered copy for un_dmg, and adds a Unix test for skipped metadata and preserved application content.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: jambalaya56562

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: skipping volume metadata during DMG extraction.
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.
  • Fix all pre-merge checks with AI

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule violations identified.

Summary

This PR fixes DMG extraction failures caused by unreadable macOS volume metadata.

  • Adds a root-only metadata skip list matching Homebrew’s DMG handling.
  • Preserves identically named entries nested within application bundles and other payload directories.
  • Adds a regression test covering unreadable .Trashes metadata and nested payload preservation.

Reviews (1) · Last reviewed commit: "fix(bootstrap): skip volume metadata whe..."

@jdx
jdx merged commit adade6d into main Sep 19, 2026
47 of 48 checks passed
@jdx
jdx deleted the fix/dmg-skip-volume-metadata branch September 19, 2026 14:20
@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

The comparison never ran — an earlier step failed.

4f47dba4a2b5 vs `` · measured on the runner, not pushed to the history.

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.

1 participant