public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Milos Malik <mmalik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: test if 'restorecon -i' ignores missing filesystem objects
Date: Fri, 11 Sep 2026 13:23:27 GMT	[thread overview]
Message-ID: <178913300755.1.2188960263546112204.tests-selinux-5f241c5352ae@fedoraproject.org> (raw)

            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
+

                 reply	other threads:[~2026-09-11 13:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178913300755.1.2188960263546112204.tests-selinux-5f241c5352ae@fedoraproject.org \
    --to=mmalik@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox