-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linker copies files as a fallback when ref-linking fails #1773
Conversation
Oh nice, I didn't know this existed. |
23a75bc
to
1340a5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what the right strategy to test this is, can we create a ram disk or a virtual filesystem as non-root?
I would suggest just stubbing out |
How you implement this rust-wise, without |
@konstin - Oh sorry, I meant for manual testing (while implementing). |
…`, properly recurse in copy fallback attempts / create directories as needed, implement fallbacks when overwriting via reflinks fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
} | ||
|
||
if *attempt == Attempt::Initial { | ||
*attempt = Attempt::Subsequent; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this different than including it as an else
in the Attempt::Initial
arm?
E.g.:
diff --git a/crates/install-wheel-rs/src/linker.rs b/crates/install-wheel-rs/src/linker.rs
index 6275994f..69eff653 100644
--- a/crates/install-wheel-rs/src/linker.rs
+++ b/crates/install-wheel-rs/src/linker.rs
@@ -356,6 +356,9 @@ fn clone_recursive(
*attempt = Attempt::UseCopyFallback;
clone_recursive(site_packages, wheel, entry, attempt)?;
}
+ } else {
+ // If the first reflink succeeded, we'll use reflink for the rest of the install.
+ *attempt = Attempt::Subsequent;
}
}
Attempt::Subsequent => {
@@ -390,9 +393,6 @@ fn clone_recursive(
}
}
- if *attempt == Attempt::Initial {
- *attempt = Attempt::Subsequent;
- }
Ok(())
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be, because we also want to update the attempt value in the case of an AlreadyExists
error that we handle. For example, if we have to overwrite a file, but don't need to fall-back to copying, this else
branch would not be hit.
Summary
Fixes #1444.
In situations where the installer fails to perform a reflink, a regular file copy is also attempted, as a fallback. This circumvents issues with linking files across filesystems or volumes.
Test Plan
N/A