Skip to content

Preserve macOS cache cleanup without directory search permission - #21363

Merged
charliermarsh merged 4 commits into
charlie/bulk-file-cache-pruningfrom
zb/bulk-file-cache-pruning-followups
Aug 29, 2026
Merged

charliermarsh merged 4 commits into
charlie/bulk-file-cache-pruningfrom
zb/bulk-file-cache-pruning-followups

Conversation

@zanieb

@zanieb zanieb commented Aug 29, 2026

Copy link
Copy Markdown
Member

Stacked on #21344.

uv cache clean <package> fails on macOS when an empty file-cache shard is readable but lacks search permission: getattrlistbulk requires that permission even though the ordinary directory walk can enumerate and remove the shard. Fall back on EACCES to preserve existing cleanup behavior while retaining errors from the ordinary walk.

Also align the fallback log with nearby diagnostics and explain why directory removal is deferred.

zanieb added 4 commits August 29, 2026 10:05
Bulk link-count requests need directory search permission even when a
shard is empty. The ordinary walk can enumerate and remove an empty
`0600` shard, so propagating `EACCES` makes `uv cache clean` fail where
it previously succeeded.

Fall back to the ordinary walk on `EACCES`; it still reports permission
errors for entries it cannot access. Add a macOS integration regression
for removing an empty shard without search permission.
Include the error directly in the `debug!` message, following nearby
filesystem diagnostics and keeping the fallback reason in the message.
The nested directory forces the shard containing a symlink onto the
recursive fallback. Add a separate flat shard with an orphan, an
externally retained hardlink, and a directory symlink so cleanup also
exercises their interaction through the macOS bulk path.

Keep the nested fixture to cover recursive fallback, and assert that
only the orphan is removed from the flat shard.
Pruning visits directories before their contents so `skip_current_dir`
can bypass a shard after a bulk scan. Document why directory removal is
deferred and reversed to preserve child-before-parent removal for
nested directories and the ordinary traversal.
@zanieb zanieb added the test:macos Enable macOS tests for a pull request label Aug 29, 2026
@charliermarsh
charliermarsh marked this pull request as ready for review August 29, 2026 23:48
@charliermarsh
charliermarsh merged commit 409aa66 into charlie/bulk-file-cache-pruning Aug 29, 2026
60 checks passed
@charliermarsh
charliermarsh deleted the zb/bulk-file-cache-pruning-followups branch August 29, 2026 23:48
charliermarsh pushed a commit that referenced this pull request Aug 31, 2026
)

Stacked on #21344.

`uv cache clean <package>` fails on macOS when an empty file-cache shard
is readable but lacks search permission: `getattrlistbulk` requires that
permission even though the ordinary directory walk can enumerate and
remove the shard. Fall back on `EACCES` to preserve existing cleanup
behavior while retaining errors from the ordinary walk.

Also align the fallback log with nearby diagnostics and explain why
directory removal is deferred.

This branch was previously deployed

1 inactive deployment
automations — 17aa89c1 Deployed Aug 29, 2026 by zanieb via review / security review #45488
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:macos Enable macOS tests for a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants