Fix RUSTUP_PERMIT_COPY_RENAME condition so it is actually used#3292
Merged
rbtcollins merged 1 commit intorust-lang:masterfrom Mar 30, 2023
Merged
Conversation
The addition of the experimental io::ErrorKind::CrossesDevices variant prevented the RUSTUP_PERMIT_COPY_RENAME condition on io::ErrorKind::Other from matching. This shows why it is a bad idea to explicitly match on io::ErrorKind::Other rather than using the default pattern and it doesn't seem like there was any need to do that anyways given the raw_os_error condition.
Contributor
|
@hi-rustin letting you know I'm merging this in - its a regression fix, and super simple |
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.
cc @mckaymatt
Problem
It looks like #2410 stopped working because it has a match on the io::ErrorKind::Other, but the experimental io::ErrorKind::CrossesDevices variant was later added, which prevented it from every matching the match arm for the RUSTUP_PERMIT_COPY_RENAME condition. As such, it would never fallback to copying and deleting and just continue failing with the "Invalid cross-device link" error.
Solution
An explicit match on io::ErrorKind::Other wasn't necessary (it already is conditional on the raw_os_error) and this bug showed how matching on it makes the code fragile to the addition to new variants, so I just replaced it with a
_catch all match with the same condition.Testing
I've managed to manual test this in isolation, although the use of
sudoto mount an overlayfs seems like it would be a problem with testing this throughcargo test.On master, I get the "could not rename component file" error, but it works when retrying the above steps on this branch.