From 5e929577a8afae4e2161d3dc0ab826e248067d2d Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 18 Apr 2025 13:19:18 +0200 Subject: [PATCH 1/3] ci: lint with selinux --- .github/workflows/CICD.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 890cc734a..df1fba73c 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -1198,3 +1198,5 @@ jobs: run: | lima ls lima bash -c "cd work && cargo test --features 'feat_selinux'" + - name: Lint with SELinux + run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' -- -D warnings" From 0309ccd28be34492ddbe1508d94fe66406f6eb76 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 18 Apr 2025 13:47:31 +0200 Subject: [PATCH 2/3] selinux: fix empty_line_after_doc_comments --- src/uucore/src/lib/features/selinux.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uucore/src/lib/features/selinux.rs b/src/uucore/src/lib/features/selinux.rs index 6686b98d4..eb5191699 100644 --- a/src/uucore/src/lib/features/selinux.rs +++ b/src/uucore/src/lib/features/selinux.rs @@ -144,7 +144,6 @@ pub fn set_selinux_security_context(path: &Path, context: Option<&String>) -> Re /// Err(Error::ContextConversionFailure) => println!("Failed to convert the security context to a string"), /// } /// ``` - pub fn get_selinux_security_context(path: &Path) -> Result { if !is_selinux_enabled() { return Err(Error::SELinuxNotEnabled); From 3210638168d8df2cfb625b6e78d17060e4631561 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 18 Apr 2025 13:52:47 +0200 Subject: [PATCH 3/3] ls,stat: fix single_char_pattern in tests --- tests/by-util/test_ls.rs | 6 +++--- tests/by-util/test_stat.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4667cef43..0cc965e14 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -4193,10 +4193,10 @@ fn test_ls_context_long() { for c_flag in ["-Zl", "-Zal"] { let result = scene.ucmd().args(&[c_flag, "foo"]).succeeds(); - let line: Vec<_> = result.stdout_str().split(" ").collect(); - assert!(line[0].ends_with(".")); + let line: Vec<_> = result.stdout_str().split(' ').collect(); + assert!(line[0].ends_with('.')); assert!(line[4].starts_with("unconfined_u")); - let s: Vec<_> = line[4].split(":").collect(); + let s: Vec<_> = line[4].split(':').collect(); assert!(s.len() == 4); } } diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 9587367e8..6c4258189 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -511,6 +511,6 @@ fn test_stat_selinux() { .stdout_contains("system_u"); // Count that we have 4 fields let result = ts.ucmd().arg("--printf='%C'").arg("/bin/").succeeds(); - let s: Vec<_> = result.stdout_str().split(":").collect(); + let s: Vec<_> = result.stdout_str().split(':').collect(); assert!(s.len() == 4); }