cp: fix -p to not preserve xattrs by default#9708
Conversation
|
GNU testsuite comparison: |
Merging this PR will not alter performance
Comparing Footnotes
|
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
| ); | ||
|
|
||
| // mode, ownership, and timestamps should be preserved | ||
| #[cfg(not(any(target_os = "freebsd", target_os = "macos")))] |
There was a problem hiding this comment.
I think these are redundant because its at the top of the test already
| use std::process::Command; | ||
| use uutests::util::compare_xattrs; | ||
|
|
||
| let scene = TestScenario::new(util_name!()); |
There was a problem hiding this comment.
Could you use the at_and_ucmd macro here?
|
I think the issue that was provided was an oversimplification and luckily the GNU test catches it. The issue #9704 is correct that cp -p shouldn't preserve general xattrs, the implementation in PR #9708 is too expansive - it also removes ACL preservation, which GNU cp -p does support. We need to make a fix with granular xattr handling that preserves ACLs but not other xattrs. |
|
Maybe combining your approach with changing of the preserve code to also add ACL xattrs? |
|
i will look into this today |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
| @@ -16,7 +16,7 @@ use std::os::unix::net::UnixListener; | |||
| use std::path::{Path, PathBuf, StripPrefixError}; | |||
| use std::{fmt, io}; | |||
| #[cfg(all(unix, not(target_os = "android")))] | |||
| use uucore::fsxattr::copy_xattrs; | |||
| use uucore::fsxattr::{copy_acl_xattrs, copy_xattrs}; | |||
There was a problem hiding this comment.
for some reason this doesn't come up for me when I locally run it, should I be adding the openbsd flag here too, that we have on :1722?
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
12ddfdd to
c00b554
Compare
|
GNU testsuite comparison: |
Fixes uutils#9704 The -p flag should only preserve mode, ownership, and timestamps, matching GNU cp behavior. Extended attributes require explicit --preserve=xattr or -a (archive mode). Changed Attributes::DEFAULT to set xattr preservation to No, preventing unintended security risks and filesystem compatibility issues. Adds regression test.
c00b554 to
13877ac
Compare
Fixes #9704
The -p flag should only preserve mode, ownership, and timestamps, matching GNU cp behavior. Extended attributes require explicit --preserve=xattr or -a (archive mode).
Changed Attributes::DEFAULT to set xattr preservation to No, preventing unintended security risks and filesystem compatibility issues.
Adds regression test.