src/uu/cp/src/cp.rs:1614-1625:
if options.parents {
for (x, y) in aligned_ancestors(source, dest.as_path()) {
if let Ok(src) = canonicalize(x, MissingHandling::Normal, ResolveMode::Physical) {
copy_attributes(&src, y, &options.attributes, false, options.set_selinux_context)?;
}
}
}
src/uu/cp/src/copydir.rs:596-610:
if options.parents {
let dest = root.file_name()
.map_or_else(|| target.to_path_buf(), |name| target.join(name));
for (x, y) in aligned_ancestors(root, dest.as_path()) {
if let Ok(src) = canonicalize(x, MissingHandling::Normal, ResolveMode::Physical) {
copy_attributes(&src, y, &options.attributes, false, options.set_selinux_context)?;
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
...
}
}
}
Same aligned_ancestors walk, same canonicalize per ancestor, same copy_attributes call with the same five arguments. The copies have already drifted: the copydir version carries an extra SELinux block the cp.rs version does not
src/uu/cp/src/cp.rs:1614-1625:src/uu/cp/src/copydir.rs:596-610:Same
aligned_ancestorswalk, samecanonicalizeper ancestor, samecopy_attributescall with the same five arguments. The copies have already drifted: thecopydirversion carries an extra SELinux block thecp.rsversion does not