Description of problem: semanage fcontext reports invalid regex, but /etc/selinux/targeted/contexts/files/file_contexts.local is still affected by the command Version-Release number of selected component (if applicable): policycoreutils-2.4-21.fc23.x86_64 How reproducible: Steps to Reproduce: 1. $sudo semanage fcontext -a -t httpd_sys_content_t "(/.*)?" Actual results: /etc/selinux/targeted/contexts/files/file_contexts.local: line 5 has invalid regex (/.*)?: out of memory PCRE study failed for ^(/.*)?$: (null) libsemanage.sefcontext_compile: sefcontext_compile returned error code 255. Compiling /etc/selinux/targeted/contexts/files/file_contexts.local (No such file or directory). /etc/selinux/targeted/contexts/files/file_contexts.local: line 5 has invalid regex (/.*)?: out of memory PCRE study failed for ^(/.*)?$: (null) libsemanage.sefcontext_compile: sefcontext_compile returned error code 255. Compiling /etc/selinux/targeted/contexts/files/file_contexts.local (No such file or directory). FileNotFoundError: [Errno 2] No such file or directory Expected results: -
Before moving new version of policy (containing requested changes) to the binary policy path (semanage_install_final_tmp - semanage_store.c), current policy is backed up (so that when new policy fails to compile, changes can be undone). (This process takes place in semanage_commit_sandbox). However the backup doesn't contain "file_contexts.local" and therefore is useless in this case. Specifically, the backup process deals with the following paths: backup "/var/lib/selinux/targeted/previous" sandbox "/var/lib/selinux/targeted/tmp" active "/var/lib/selinux/targeted/active" And semanage_install_final_tmp deals with: src: (probably should be contained in "active" path above) "/var/lib/selinux/tmp/targeted/contexts/files/file_contexts" dst: "/etc/selinux/targeted/contexts/files/file_contexts" Upon failure of semanage_install_final_tmp, the backup is retrieved (backup -> active), but this change doesn't influence the paths that semanage_install_final_tmp deals with and the system is left with invalid "/etc/selinux/targeted/contexts/files/file_contexts.local" file (that is why the error message is repeated twice - semanage_install_final_tmp is run 2 times on the same set of files).
The issue is solved on upstream and the fix will propagate to fedora branch during next rebase. https://github.com/SELinuxProject/selinux/commit/a7334eb0de98af11ec38b6263536fa01bc2a606c https://github.com/SELinuxProject/selinux/commit/6e2bdb770f6311060b111e87bd7af653e225be9d
checkpolicy-2.5-8.fc25, libselinux-2.5-12.fc25, libsemanage-2.5-8.fc25, libsepol-2.5-10.fc25, policycoreutils-2.5-17.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b7e8e980ef
checkpolicy-2.5-8.fc25, libselinux-2.5-12.fc25, libsemanage-2.5-8.fc25, libsepol-2.5-10.fc25, policycoreutils-2.5-17.fc25, secilc-2.5-6.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b7e8e980ef
checkpolicy-2.5-8.fc25, libselinux-2.5-12.fc25, libsemanage-2.5-8.fc25, libsepol-2.5-10.fc25, policycoreutils-2.5-17.fc25, secilc-2.5-6.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.