public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: setsebool: Do not test aliases for non-existing booleans
@ 2026-09-11 13:22 Petr Lautrbach
  0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-09-11 13:22 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : d55f7ad6aec7dce0818851e44891a0eb1b163327
            Author : Petr Lautrbach <lautrbach@redhat.com>
            Date   : 2025-03-10T12:20:06+01:00
            Stats  : +8/-3 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/d55f7ad6aec7dce0818851e44891a0eb1b163327?branch=pr775-checkpolicy-revdeps

            Log:
            setsebool: Do not test aliases for non-existing booleans

In CentOS Stream 10 some modules were moved from selinux-policy to
selinux-policy-epel which is available only in EPEL. It caused problem
with non-existing booleans and their aliases. With this change, an alias
is not checked when a new boolean does not exist.

Fixes:
    Error getting active value for puppet_manage_all_files
    [   PASS   ] :: Command 'getsebool puppet_manage_all_files 2>&1 | tee /tmp/tmp.nx2NlWq1zd' (Expected 0, got 0)
    [  BEGIN   ] :: Running 'getsebool puppetagent_manage_all_files 2>&1 | tee -a /tmp/tmp.nx2NlWq1zd'
    Error getting active value for puppetagent_manage_all_files
    [   PASS   ] :: Command 'getsebool puppetagent_manage_all_files 2>&1 | tee -a /tmp/tmp.nx2NlWq1zd' (Expected 0, got 0)
    [  BEGIN   ] :: Running 'uniq -c /tmp/tmp.nx2NlWq1zd | grep '2 ''
    [   FAIL   ] :: Command 'uniq -c /tmp/tmp.nx2NlWq1zd | grep '2 '' (Expected 0, got 1)

---
diff --git a/policycoreutils/setsebool/runtest.sh b/policycoreutils/setsebool/runtest.sh
index 8678b1b..04878f9 100755
--- a/policycoreutils/setsebool/runtest.sh
+++ b/policycoreutils/setsebool/runtest.sh
@@ -114,9 +114,14 @@ rlJournalStart
         for LINE in `cat /etc/selinux/*/booleans.subs_dist | sort | uniq | tr -s ' ' | tr ' ' ':'` ; do
             OLD_BOOLEAN_NAME=`echo ${LINE} | cut -d : -f 1`
             NEW_BOOLEAN_NAME=`echo ${LINE} | cut -d : -f 2`
-            rlRun "getsebool ${OLD_BOOLEAN_NAME} 2>&1 | tee ${OUTPUT_FILE}"
-            rlRun "getsebool ${NEW_BOOLEAN_NAME} 2>&1 | tee -a ${OUTPUT_FILE}"
-            rlRun "uniq -c ${OUTPUT_FILE} | grep '2 '"
+            # do not test this if the new boolean does not exist in the policy
+            if getsebool ${NEW_BOOLEAN_NAME} &> /dev/null; then
+                rlRun "getsebool ${OLD_BOOLEAN_NAME} 2>&1 | tee ${OUTPUT_FILE}"
+                rlRun "getsebool ${NEW_BOOLEAN_NAME} 2>&1 | tee -a ${OUTPUT_FILE}"
+                rlRun "uniq -c ${OUTPUT_FILE} | grep '2 '"
+            else
+                rlLog "$NEW_BOOLEAN_NAME does not exist, skip"
+            fi
         done
     rlPhaseEnd
     fi

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:22 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:22 [tests/selinux] pr775-checkpolicy-revdeps: setsebool: Do not test aliases for non-existing booleans Petr Lautrbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox