Skip to content

Commit dcedd7e

Browse files
committed
ls: add selinux/smack cfg alias
1 parent 093d9d2 commit dcedd7e

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
@@ -1604,7 +1604,7 @@ fn get_security_context<'a>(
16041604
}
16051605
}
16061606

1607-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
1607+
#[cfg(selinux)]
16081608
if config.selinux_supported {
16091609
use uucore::show_warning;
16101610

@@ -1646,7 +1646,7 @@ fn get_security_context<'a>(
16461646
}
16471647
}
16481648

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

0 commit comments

Comments
 (0)