coreutils
coreutils copied to clipboard
cp: Do not canonicalize paths, just dereference as needed
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.
GNU testsuite comparison:
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cp/preserve-gid is no longer failing!
GNU testsuite comparison:
Congrats! The gnu test tests/cp/preserve-gid is no longer failing!
This, the good news.
The bad news is that so many tests are failing with... strange errors. I guess serial_test has... interesting side effects.
it has been draft for a long time, please reopen when ready