Skip to content
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

cp: preserve permissions when copying directory and don't terminate early on inaccessible file #3973

Merged
merged 5 commits into from
Oct 10, 2022

Conversation

jfinkels
Copy link
Collaborator

This pull request includes two related fixes to cp.

First, we make cp preserve the permissions of a directory when copying it. Before this commit,

cp -pR src/ dest/

failed to copy the permissions of src/ to dest/. After this commit, the permissions are correctly copied.

Second, we make stop cp from terminating prematurely if a file in a directory is inaccesible due to insufficient permissions.

These two changes fix on assertion in GNU test suite file tests/cp/fail-perm.sh (but it will not be passing yet).

@jfinkels jfinkels force-pushed the cp-directory-preserve-permissions branch 3 times, most recently from f0a3a52 to e44db65 Compare September 26, 2022 03:54
Create `assert_metadata_eq!()` macro to contain a series of assertions
that check whether two `Metadata` objects are equal.
Add the `AtPath.set_mode()` method that sets the permissions for a
given path in the test directory.
Create a `copy_attributes()` function to contain the loop that copies
each of a specified set of attributes in turn.
Make cp preserve the permissions of a directory when copying
it. Before this commit,

    cp -pR src/ dest/

failed to copy the permissions of `src/` to `dest/`. After this
commit, the permissions are correctly copied.
Stop `cp` from terminating prematurely if a file in a directory is
inaccesible due to insufficient permissions.
@jfinkels jfinkels force-pushed the cp-directory-preserve-permissions branch from 96a5169 to b89e8e5 Compare October 9, 2022 21:31
@github-actions
Copy link

Congrats! The gnu test tests/misc/tee is no longer failing!
Congrats! The gnu test tests/ls/readdir-mountpoint-inode is no longer failing!
Congrats! The gnu test tests/misc/sync is no longer failing!
GNU test failed: tests/misc/tee. tests/misc/tee is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/misc/tee is no longer failing!

@sylvestre sylvestre merged commit ad0ca2f into uutils:main Oct 10, 2022
@sylvestre
Copy link
Contributor

great work

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.

2 participants