public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test how semanage handles spaces in fcontext patterns
@ 2026-09-11 13:20 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:20 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 01e114b092f2cbd82ba6dacf3f42d9fc3ae94e2b
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2022-07-15T13:27:05+00:00
            Stats  : +164/-0 in 4 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/01e114b092f2cbd82ba6dacf3f42d9fc3ae94e2b?branch=pr775-checkpolicy-revdeps

            Log:
            test how semanage handles spaces in fcontext patterns

The semanage tool refuses (for some time already) fcontext patterns
which contain spaces. The TC checks if other whitespace characters
are treated the same way.

The TC covers BZ#1893545.

---
diff --git a/policycoreutils/spaces-in-fcontext-patterns/Makefile b/policycoreutils/spaces-in-fcontext-patterns/Makefile
new file mode 100644
index 0000000..b39090e
--- /dev/null
+++ b/policycoreutils/spaces-in-fcontext-patterns/Makefile
@@ -0,0 +1,66 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/policycoreutils/Regression/spaces-in-fcontext-patterns
+#   Description: Does semanage accept spaces in fcontext patterns?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2020 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/policycoreutils/Regression/spaces-in-fcontext-patterns
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	chmod a+x runtest.sh
+	chcon -t bin_t runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Milos Malik <mmalik@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     Does semanage accept spaces in fcontext patterns?" >> $(METADATA)
+	@echo "Type:            Regression" >> $(METADATA)
+	@echo "TestTime:        10m" >> $(METADATA)
+	@echo "RunFor:          policycoreutils" >> $(METADATA)
+	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted /usr/sbin/semanage" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Releases:        -RHEL4 -RHEL5 -RHEL6 -RHEL7" >> $(METADATA)
+	@echo "Bug:             1893545" >> $(METADATA) # Fedora 32
+
+	rhts-lint $(METADATA)
+

diff --git a/policycoreutils/spaces-in-fcontext-patterns/PURPOSE b/policycoreutils/spaces-in-fcontext-patterns/PURPOSE
new file mode 100644
index 0000000..db31d4a
--- /dev/null
+++ b/policycoreutils/spaces-in-fcontext-patterns/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/policycoreutils/Regression/spaces-in-fcontext-patterns
+Author: Milos Malik <mmalik@redhat.com>
+
+Description: Does semanage accept spaces in fcontext patterns?
+

diff --git a/policycoreutils/spaces-in-fcontext-patterns/main.fmf b/policycoreutils/spaces-in-fcontext-patterns/main.fmf
new file mode 100644
index 0000000..ad152e7
--- /dev/null
+++ b/policycoreutils/spaces-in-fcontext-patterns/main.fmf
@@ -0,0 +1,37 @@
+summary: Does semanage accept spaces in fcontext patterns?
+description: |+
+  Does semanage accept spaces in fcontext patterns?
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+  - policycoreutils
+test: ./runtest.sh
+framework: beakerlib
+recommend:
+  - audit
+  - libselinux
+  - libselinux-utils
+  - policycoreutils
+  - selinux-policy
+  - selinux-policy-targeted
+  - /usr/sbin/semanage
+environment:
+    AVC_ERROR: +no_avc_check
+duration: 10m
+enabled: true
+tag:
+  - CI-Tier-1
+  - NoRHEL4
+  - NoRHEL5
+  - NoRHEL6
+  - NoRHEL7
+  - Tier1
+  - Tier1se
+  - targeted
+tier: '1'
+link:
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1893545
+adjust:
+  - enabled: false
+    when: distro == rhel-4, rhel-5, rhel-6, rhel-7
+    continue: false

diff --git a/policycoreutils/spaces-in-fcontext-patterns/runtest.sh b/policycoreutils/spaces-in-fcontext-patterns/runtest.sh
new file mode 100755
index 0000000..ea57c89
--- /dev/null
+++ b/policycoreutils/spaces-in-fcontext-patterns/runtest.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/policycoreutils/Regression/spaces-in-fcontext-patterns
+#   Description: Does semanage accept spaces in fcontext patterns?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2020 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="policycoreutils"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlAssertRpm ${PACKAGE}
+        rlRun "rpm -qf `which semanage`"
+    rlPhaseEnd
+
+    rlPhaseStartTest "bz#1893545"
+        rlRun "semanage fcontext -l -C"
+        rlRun "semanage fcontext -a -t public_content_t '/mnt/media/My\ Dir(/.*)?'" 1
+        rlRun "semanage fcontext -a -t public_content_t '/mnt/media/My	Dir(/.*)?'" 1
+        rlRun "semanage fcontext -a -t public_content_t '/mnt/media/My\rDir(/.*)?'" 1
+        rlRun "semanage fcontext -l -C"
+        rlRun "semanage fcontext -d -t public_content_t '/mnt/media/My\ Dir(/.*)?'" 1
+        rlRun "semanage fcontext -d -t public_content_t '/mnt/media/My	Dir(/.*)?'" 1
+        rlRun "semanage fcontext -d -t public_content_t '/mnt/media/My\rDir(/.*)?'" 1
+        rlRun "semanage fcontext -l -C"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+

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

only message in thread, other threads:[~2026-09-11 13:20 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:20 [tests/selinux] pr775-checkpolicy-revdeps: test how semanage handles spaces in fcontext patterns Milos Malik

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