Skip to content

Commit ed06c14

Browse files
authored
fix(mv): correct selinux cfg gating for non-Linux platforms (#10989)
The mv command was using #[cfg(feature = "selinux")] but the uucore selinux module requires both the feature AND Linux/Android target OS. This caused build failures on macOS when the selinux feature was enabled. Changed both the import and usage to use: #[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))] This aligns mv with other utilities (cp, install, stat, ls) that correctly gate selinux functionality.
1 parent 10d864a commit ed06c14

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/uu/mv/src/mv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use uucore::fs::{
4747
};
4848
#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
4949
use uucore::fsxattr;
50-
#[cfg(feature = "selinux")]
50+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
5151
use uucore::selinux::set_selinux_security_context;
5252
use uucore::translate;
5353
use uucore::update_control;
@@ -770,7 +770,7 @@ fn rename(
770770
rename_with_fallback(from, to, display_manager, opts.verbose, None, None)?;
771771
}
772772

773-
#[cfg(feature = "selinux")]
773+
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
774774
if let Some(ref context) = opts.context {
775775
set_selinux_security_context(to, Some(context))
776776
.map_err(|e| io::Error::other(e.to_string()))?;

0 commit comments

Comments
 (0)