public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: fix hidden failure in check_contexts
@ 2026-09-11 13:17 Jan Zarsky
0 siblings, 0 replies; only message in thread
From: Jan Zarsky @ 2026-09-11 13:17 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 4d8e2de3cda97685e0188b6ee9c93a8c2f139748
Author : Jan Zarsky <jzarsky@redhat.com>
Date : 2018-10-15T10:46:49+02:00
Stats : +7/-4 in 1 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/4d8e2de3cda97685e0188b6ee9c93a8c2f139748?branch=pr775-checkpolicy-revdeps
Log:
fix hidden failure in check_contexts
check_contexts was checking contexts in a loop and there was no warning
when there were no files to check (because of invalid parameter). Fix
this by counting the files to be checked.
Fix also one invalid call to check_contexts.
---
diff --git a/policycoreutils/restorecon/runtest.sh b/policycoreutils/restorecon/runtest.sh
index b16d4c0..aa7570c 100755
--- a/policycoreutils/restorecon/runtest.sh
+++ b/policycoreutils/restorecon/runtest.sh
@@ -111,10 +111,13 @@ rlJournalStart
# Check that files matching with $2 in dir $1 have context $3
function check_contexts {
- COMMAND="find $1 -name '$2'"
- for ITEM in `eval $COMMAND`; do
- rlRun "ls -ladZ $ITEM | grep :$3";
+ rlRun "find $1 -name '$2' >files"
+ rlRun "[ $(cat files | wc -l) -gt 0 ]"
+
+ for f in $files; do
+ rlRun "ls -ladZ $f | grep :$3"
done
+ rlRun "rm files"
}
# Create the testing dirs and files
@@ -184,7 +187,7 @@ EOF"
check_initial_contexts 'incorrect1.dir'
check_initial_contexts 'correct.dir'
check_initial_contexts 'customizable.dir'
- check_contexts 'incorrect2' '*' 'correct_t'
+ check_contexts 'incorrect2.dir' '*' 'correct_t'
rlRun "ls -ladZ customizable.file | grep customizable_t"
rlRun "ls -ladZ incorrect.file | grep :correct_t"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:17 [tests/selinux] pr775-checkpolicy-revdeps: fix hidden failure in check_contexts Jan Zarsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox