Skip to content

Commit 37d27e0

Browse files
committed
ls: add selinux/smack cfg alias
1 parent ae31944 commit 37d27e0

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/ls/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ workspace = true
2020
path = "src/ls.rs"
2121
doctest = false
2222

23+
[build-dependencies]
24+
cfg_aliases.workspace = true
25+
2326
[dependencies]
2427
ansi-width = { workspace = true }
2528
clap = { workspace = true, features = ["env"] }

src/uu/ls/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This file is part of the uutils coreutils package.
2+
//
3+
// For the full copyright and license information, please view the LICENSE
4+
// file that was distributed with this source code.
5+
6+
use cfg_aliases::cfg_aliases;
7+
8+
pub fn main() {
9+
cfg_aliases! {
10+
selinux: { all(feature = "selinux", any(target_os = "android", target_os = "linux")) },
11+
smack: { all(feature = "smack", target_os = "linux") },
12+
}
13+
}

src/uu/ls/src/ls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ fn get_security_context<'a>(
14431443
}
14441444
}
14451445

1446-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
1446+
#[cfg(selinux)]
14471447
if config.selinux_supported {
14481448
use uucore::show_warning;
14491449

@@ -1485,7 +1485,7 @@ fn get_security_context<'a>(
14851485
}
14861486
}
14871487

1488-
#[cfg(all(feature = "smack", target_os = "linux"))]
1488+
#[cfg(smack)]
14891489
if config.smack_supported {
14901490
// For SMACK, use the path to get the label
14911491
// If must_dereference is true, we follow the symlink

0 commit comments

Comments
 (0)