Skip to content

Commit

Permalink
mv: avoid attempting to set xattr on redox
Browse files Browse the repository at this point in the history
  • Loading branch information
dahc authored and BenWiederhake committed Apr 12, 2024
1 parent 5bf939a commit 9d82fa3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/uu/mv/src/mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use uucore::fs::{
are_hardlinks_or_one_way_symlink_to_same_file, are_hardlinks_to_same_file,
path_ends_with_terminator,
};
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
use uucore::fsxattr;
use uucore::update_control;

Expand Down Expand Up @@ -634,7 +634,7 @@ fn rename_with_fallback(
None
};

#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
let xattrs =
fsxattr::retrieve_xattrs(from).unwrap_or_else(|_| std::collections::HashMap::new());

Expand All @@ -648,7 +648,7 @@ fn rename_with_fallback(
move_dir(from, to, &options)
};

#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
fsxattr::apply_xattrs(to, xattrs).unwrap();

if let Err(err) = result {
Expand All @@ -661,11 +661,11 @@ fn rename_with_fallback(
};
}
} else {
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
fs::copy(from, to)
.and_then(|_| fsxattr::copy_xattrs(&from, &to))
.and_then(|_| fs::remove_file(from))?;
#[cfg(any(target_os = "macos", not(unix)))]
#[cfg(any(target_os = "macos", target_os = "redox", not(unix)))]
fs::copy(from, to).and_then(|_| fs::remove_file(from))?;
}
}
Expand Down

0 comments on commit 9d82fa3

Please sign in to comment.