cp: Do not canonicalize paths, just dereference as needed #8475
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.
Fixes #8452.
Writing a test for this is... tricky, and racy, ended up importing the
serial_test
crate... I wonder (I'm sure) we can do better... But, I also wonder if this could help with our CI flakes.--
test_cp: Run all tests in parallel
Except test_cp_preserve_unreadable_parent, that needs to change
the current directory.
Cargo.toml: Add serial_test crate
test_cp: test attribute restoration when a parent directory is not accessible
tests/cp/preserve-gid indirectly/accidentally also tests for that,
as it uses chroot with a different user.
Note that this test cannot run in parallel with others in the suite,
as changing current directory has side effects.
cp: copy_attributes: Add parameter to tell if source should be dereferenced
We should not canonicalize pathnames unless absolutely necessary.
Here, we are just interested in dereferencing symlinks, sometimes.
This used to break attribute restoration when a user doesn't have read
access to one of the parent directories of the current path.