public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if 'restorecon -i' ignores missing filesystem objects
@ 2026-09-11 13:23 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:23 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 5f241c5352ae00434af443eb118b497fb9294727
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2025-11-25T22:50:31+01:00
            Stats  : +68/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/5f241c5352ae00434af443eb118b497fb9294727?branch=pr775-checkpolicy-revdeps

            Log:
            test if 'restorecon -i' ignores missing filesystem objects

A recently reported customer case revealed that the restorecon
program produces error messages even if it was executed with
the '-i' option. In such case no error messages should appear
when the inspected filesystem objects are missing.

The TC reproduces the situation when old libselinux/policycoreutils
packages are installed.

The TC covers RHEL-110181 and RHEL-123884.

---
diff --git a/policycoreutils/restorecon-ignores-missing/main.fmf b/policycoreutils/restorecon-ignores-missing/main.fmf
new file mode 100644
index 0000000..eaf0fcb
--- /dev/null
+++ b/policycoreutils/restorecon-ignores-missing/main.fmf
@@ -0,0 +1,27 @@
+summary: 'restorecon -i' should ignore missing files/directories
+description: Does 'restorecon -i' work as expected?
+contact: Milos Malik <mmalik@redhat.com>
+component:
+  - libselinux
+  - policycoreutils
+recommend:
+  - libselinux
+  - policycoreutils
+duration: 5m
+enabled: true
+tag:
+  - CI-Tier-1
+  - NoRHEL4
+  - NoRHEL5
+  - NoRHEL6
+  - NoRHEL7
+  - NoRHEL8
+  - targeted
+tier: 1
+link:
+  - verifies: https://issues.redhat.com/browse/RHEL-110181
+  - verifies: https://issues.redhat.com/browse/RHEL-123884
+adjust+:
+  - enabled: false
+    when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8
+    continue: false

diff --git a/policycoreutils/restorecon-ignores-missing/runtest.sh b/policycoreutils/restorecon-ignores-missing/runtest.sh
new file mode 100755
index 0000000..f7e0049
--- /dev/null
+++ b/policycoreutils/restorecon-ignores-missing/runtest.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+. /usr/share/beakerlib/beakerlib.sh
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "rpm -qa | grep -e libselinux -e policycoreutils | sort"
+        rlRun "man restorecon | col -b | grep -i 'ignore.*exist'"
+        rlRun "mkdir -p tmp"
+        OUTPUT_FILE=`mktemp`
+    rlPhaseEnd
+
+    rlPhaseStartTest "RHEL-110181 + RHEL-123884"
+        rlRun "pushd tmp"
+        rlLog "starting the creator process"
+        ( while true ; do
+            mkdir dir
+            mkfifo fifo
+            touch file
+            chcon -t etc_t dir fifo file
+            rm -rf dir fifo file
+        done ) &
+        CREATOR_PID=$!
+        rlRun "popd"
+
+        rlLog "starting the restorecon process"
+        ( while true ; do restorecon -RFivv tmp ; done ) >& ${OUTPUT_FILE} &
+        RESTORECON_PID=$!
+
+        rlRun "sleep 30s"
+        rlRun "kill ${CREATOR_PID}" 0,1
+        rlRun "kill ${RESTORECON_PID}" 0,1
+        rlRun "ls -l ${OUTPUT_FILE}"
+        rlRun "grep -i -e 'no such file' -e 'not set context' ${OUTPUT_FILE}" 1
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "rm -rf tmp ${OUTPUT_FILE}"
+    rlPhaseEnd
+rlJournalEnd
+

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

only message in thread, other threads:[~2026-09-11 13:23 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:23 [tests/selinux] pr775-checkpolicy-revdeps: test if 'restorecon -i' ignores missing filesystem objects Milos Malik

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