fix: Fall back to mkdir when clonefile fails on non-APFS filesystems#2260
Merged
baszalmstra merged 1 commit intoconda:mainfrom Mar 19, 2026
Merged
Conversation
baszalmstra
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I think the macOS directory clonefile optimization (using reflinks) implemented in #995 overlooked the case for filesystems which do not support reflinks. I noticed an error like this
and in my case this is on a HFS+ filesystem, but I think the bug would also occur on NFS, SMB, exFAT and so on.
In the case of single files, there is some fallback logic if reflinks are not supported, see the following
rattler/crates/rattler/src/install/link.rs
Lines 426 to 443 in 6462049
but for the directory case there is no such fallback logic and it just errors, see the following
rattler/crates/rattler/src/install/mod.rs
Lines 792 to 811 in 6462049
The fix adds a catch-all fallback that creates the directory and disables further clonefile attempts for the remaining directories in the package. Individual files are then linked via hardlink (or copy).
This mirrors the approach already used by the single file reflink code and restores installation on non-APFS macOS volumes.
Open question: Currently I'm changing
allow_ref_linksto be mutable such that after the first clonefile failure we set it to false to no spam further failures. But I'm not sure if this is a clean solution.How Has This Been Tested?
hdiutil create -size 2g -fs HFS+ -volname testhfs /tmp/testhfs.dmg && hdiutil attach /tmp/testhfs.dmgcd /Volumes/testhfs/project && pixi init && pixi add pythonPIXI_CACHE_DIR=/Volumes/testhfs/cache pixi installallow_ref_links = true):rm -rf .pixi && PIXI_CACHE_DIR=/Volumes/testhfs/cache pixi installfailed to create directory ... Operation not supported (os error 45)AI Disclosure
Tools: Claude Code with Opus 4.6
Checklist: