Skip to content

Commit 504a5b3

Browse files
committed
ls: add selinux/smack cfg alias
1 parent 9fdac89 commit 504a5b3

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
@@ -1576,7 +1576,7 @@ fn get_security_context<'a>(
15761576
}
15771577
}
15781578

1579-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
1579+
#[cfg(selinux)]
15801580
if config.selinux_supported {
15811581
use uucore::show_warning;
15821582

@@ -1618,7 +1618,7 @@ fn get_security_context<'a>(
16181618
}
16191619
}
16201620

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

0 commit comments

Comments
 (0)