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: adapt to semanage port dealing with duplicated local customization
Date: Fri, 11 Sep 2026 13:21:23 GMT	[thread overview]
Message-ID: <178913288319.1.14578362030284017021.tests-selinux-85a3f368bdbb@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 85a3f368bdbba5bf8a6daa1223c3e821c940f936
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2024-02-15T08:09:55+01:00
            Stats  : +15/-9 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/85a3f368bdbba5bf8a6daa1223c3e821c940f936?branch=pr775-checkpolicy-revdeps

            Log:
            adapt to semanage port dealing with duplicated local customization

The semanage command from older policycoreutils versions (<= 3.6-1.el9)
behaves in a certain way when a duplicated port context pattern is added.
It does not add the pattern but produces the following message:

  ValueError: Port <protocol>/<number> already defined

The semanage command from new policycoreutils versions (>= 3.6-2.el9)
behaves differently when a duplicated port context pattern is added.
It adds the pattern and produces the following message:

  Port <protocol>/<number> already defined, modifying instead

Above-mentioned differences in behavior have some consequences for the
automated test when removing a duplicated port context pattern. If the
automated test should pass, it needs to anticipate both possibilities.

---
diff --git a/policycoreutils/semanage-port-add-delete-problems/Makefile b/policycoreutils/semanage-port-add-delete-problems/Makefile
index 263da02..36cdf85 100644
--- a/policycoreutils/semanage-port-add-delete-problems/Makefile
+++ b/policycoreutils/semanage-port-add-delete-problems/Makefile
@@ -54,13 +54,14 @@ $(METADATA): Makefile
 	@echo "Type:            Regression" >> $(METADATA)
 	@echo "TestTime:        15m" >> $(METADATA)
 	@echo "RunFor:          policycoreutils" >> $(METADATA)
+	@echo "Requires:        audit" >> $(METADATA)
+	@echo "Requires:        coreutils" >> $(METADATA)
+	@echo "Requires:        grep" >> $(METADATA)
+	@echo "Requires:        libselinux" >> $(METADATA)
+	@echo "Requires:        libselinux-utils" >> $(METADATA)
 	@echo "Requires:        policycoreutils" >> $(METADATA)
 	@echo "Requires:        policycoreutils-python-utils" >> $(METADATA)
 	@echo "Requires:        setools-console" >> $(METADATA)
-	@echo "Requires:        libselinux" >> $(METADATA)
-	@echo "Requires:        libselinux-utils" >> $(METADATA)
-	@echo "Requires:        coreutils" >> $(METADATA)
-	@echo "Requires:        grep" >> $(METADATA)
 	@echo "Priority:        Normal" >> $(METADATA)
 	@echo "License:         GPLv2" >> $(METADATA)
 	@echo "Confidential:    no" >> $(METADATA)

diff --git a/policycoreutils/semanage-port-add-delete-problems/main.fmf b/policycoreutils/semanage-port-add-delete-problems/main.fmf
index d0609a9..d948252 100644
--- a/policycoreutils/semanage-port-add-delete-problems/main.fmf
+++ b/policycoreutils/semanage-port-add-delete-problems/main.fmf
@@ -6,13 +6,14 @@ contact: Milos Malik <mmalik@redhat.com>
 component:
   - policycoreutils
 recommend:
+  - audit
+  - coreutils
+  - grep
+  - libselinux
+  - libselinux-utils
   - policycoreutils
   - policycoreutils-python-utils
   - setools-console
-  - libselinux
-  - libselinux-utils
-  - coreutils
-  - grep
 duration: 15m
 extra-summary: /CoreOS/policycoreutils/Regression/semanage-port-add-delete-problems
 extra-task: /CoreOS/policycoreutils/Regression/semanage-port-add-delete-problems

diff --git a/policycoreutils/semanage-port-add-delete-problems/runtest.sh b/policycoreutils/semanage-port-add-delete-problems/runtest.sh
index 435fc40..835b043 100755
--- a/policycoreutils/semanage-port-add-delete-problems/runtest.sh
+++ b/policycoreutils/semanage-port-add-delete-problems/runtest.sh
@@ -115,8 +115,12 @@ rlJournalStart
         rlRun "semanage port -a -t smtp_port_t -p tcp 25 2>&1 | tee ${OUTPUT_FILE}"
         rlAssertGrep "port .* already defined" ${OUTPUT_FILE} -i
         rlRun "semanage port -l | grep 'smtp_port_t.*tcp.*25'"
+        rm -f ${OUTPUT_FILE}
         rlRun "semanage port -d -t smtp_port_t -p tcp 25 2>&1 | tee ${OUTPUT_FILE}"
-        rlAssertGrep "port .* is defined in policy.*cannot be deleted" ${OUTPUT_FILE} -i
+        # the error may not appear because the local customization can be deleted always
+        if [ -s ${OUTPUT_FILE} ] ; then
+            rlAssertGrep "port .* is defined in policy.*cannot be deleted" ${OUTPUT_FILE} -i
+        fi
         rlRun "semanage port -d -t smtp_port_t -p tcp 25 2>&1 | tee ${OUTPUT_FILE}"
         rlAssertGrep "port .* is defined in policy.*cannot be deleted" ${OUTPUT_FILE} -i
         rlRun "semanage port -l | grep 'smtp_port_t.*tcp.*25'"

                 reply	other threads:[~2026-09-11 13:21 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=178913288319.1.14578362030284017021.tests-selinux-85a3f368bdbb@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