Fix RUSTUP_PERMIT_COPY_RENAME condition so it is actually used #3292
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
sudo
to 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.