Skip to content

cp: Do not canonicalize paths, just dereference as needed #8475

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

drinkcat
Copy link
Collaborator

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.

…renced

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.
…cessible

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.
Except test_cp_preserve_unreadable_parent, that needs to change
the current directory.
Copy link

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!

@drinkcat
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests/cp/preserve-gid: cp -p fails to preserve group
1 participant