Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/uu/install/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,12 @@ fn standard(mut paths: Vec<OsString>, b: &Behavior) -> UResult<()> {
return Err(InstallError::SameFile(source.clone(), target.clone()).into());
}

if target.is_file() || is_new_file_path(&target) {
// An existing target that isn't a directory (regular file, device
// node, FIFO, socket, ...) should still go through the normal
// copy/overwrite path so the real removal failure is reported,
// instead of falling through to InvalidTarget's hardcoded
// "No such file or directory" (issue #9934).
if target.is_file() || is_new_file_path(&target) || (target.exists() && !target.is_dir()) {
#[cfg(unix)]
if let (Some(ref parent_fd), Some(ref filename)) = (target_parent_fd, target_filename) {
if b.compare && !need_copy(source, &target, b) {
Expand Down
Loading