Bug 2152670

Summary: undeterministic sepolicy failure creating man pages directory structure
Product: [Fedora] Fedora Reporter: Zdenek Pytela <zpytela>
Component: policycoreutilsAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: dwalsh, lvrabec, mmalik, plautrba, vmojzis
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: policycoreutils-3.5-1.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-27 11:00:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zdenek Pytela 2022-12-12 16:13:58 UTC
Description of problem:
sepolicy manpage fails during policy build

Version-Release number of selected component (if applicable):
latest rawhide

How reproducible:
sometimes

Steps to Reproduce:
1. Initiate a selinux-policy build

Actual results:
+ /usr/bin/sepolicy manpage -a -p /__w/selinux-policy/selinux-policy/rpmbuild/BUILDROOT/selinux-policy-38.2-1.20221212_150123.2b2c45d.fc38.x86_64/usr/share/man/man8/ -w -r /__w/selinux-policy/selinux-policy/rpmbuild/BUILDROOT/selinux-policy-38.2-1.20221212_150123.2b2c45d.fc38.x86_64
FileExistsError: [Errno 17] File exists: '/__w/selinux-policy/selinux-policy/rpmbuild/BUILDROOT/selinux-policy-38.2-1.20221212_150123.2b2c45d.fc38.x86_64/usr/share/man/man8/'
error: Bad exit status from /var/tmp/rpm-tmp.WY9sgI (%install)
    Bad exit status from /var/tmp/rpm-tmp.WY9sgI (%install)

RPM build errors:
Error: Process completed with exit code 1.


Expected results:
no error

Additional info:
https://github.com/fedora-selinux/selinux-policy/actions/runs/3676994136/jobs/6218369540

Comment 1 Petr Lautrbach 2022-12-12 17:32:01 UTC
modified   python/sepolicy/sepolicy/manpage.py
@@ -376,8 +376,7 @@ class ManPage:
 
         self.fcdict = sepolicy.get_fcdict(self.fcpath)
 
-        if not os.path.exists(path):
-            os.makedirs(path)
+        os.makedirs(path, exist_ok=True)
 
         self.path = path

Comment 2 Ben Cotton 2023-02-07 15:13:13 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 3 Fedora Update System 2023-02-27 18:52:11 UTC
FEDORA-2023-568a3be5b8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-568a3be5b8

Comment 4 Fedora Update System 2023-02-28 02:54:15 UTC
FEDORA-2023-568a3be5b8 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-568a3be5b8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-568a3be5b8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-03-25 02:01:38 UTC
FEDORA-2023-568a3be5b8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.