-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
cp: error when trying to preserve metadata on dangling symbolic link #3531
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Here's a failing test case: #[test]
fn test_copy_through_dangling_symlink_no_dereference_permissions() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("no-such-file", "dangle");
ucmd.args(&["-P", "-p", "dangle", "d2"]).succeeds().no_stderr().no_stdout();
at.file_exists("d2");
// `-p` means `--preserve=mode,ownership,timestamps`
#[cfg(unix)]
{
let metadata1 = at.symlink_metadata("dangle");
let metadata2 = at.symlink_metadata("d2");
assert_eq!(metadata1.mode(), metadata2.mode());
assert_eq!(metadata1.uid(), metadata2.uid());
assert_eq!(metadata1.atime(), metadata2.atime());
assert_eq!(metadata1.mtime(), metadata2.mtime());
assert_eq!(metadata1.ctime(), metadata2.ctime());
}
} The error seems to be occurring at this line: Line 1138 in d921073
set_permissions() call returns an Err ).
|
I think this may have to do with this: rust-lang/rust#75942:
Maybe the call to |
Fix a bug in which `cp` incorrectly exited with an error when attempting to copy the attributes of a dangling symbolic link (that is, when running `cp -P -p`). Fixes uutils#3531.
Fix a bug in which `cp` incorrectly exited with an error when attempting to copy the attributes of a dangling symbolic link (that is, when running `cp -P -p`). Fixes uutils#3531.
Combining the
-P
(--no-dereference
) option and the-p
(--preserve=mode,ownership,timestamps
) option in uutilscp
does not match the behavior of GNUcp
when attempting to copy a symbolic link that points to a file that does not exist. (Contrast this with issue #3364, which was just about the-P
option. That issue was resolved.)GNU cp:
uutils cp:
The text was updated successfully, but these errors were encountered: