Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1905777

Summary: %check's testsuite/inplace-selinux.sh fails when rebuilding using mock
Product: Red Hat Enterprise Linux 8 Reporter: Robert Scheck <redhat-bugzilla>
Component: sedAssignee: Jakub Martisko <jamartis>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.3CC: fsumsal, veichler
Target Milestone: rcKeywords: Triaged
Target Release: 8.4Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: sed-4.5-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 15:16:24 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 Robert Scheck 2020-12-09 03:30:13 UTC
Description of problem:
%check's testsuite/inplace-selinux.sh fails when rebuilding using mock.

Version-Release number of selected component (if applicable):
sed-4.5-2.el8

How reproducible:
Everytime, see above and below.

Actual results:
I've added "ls -lZ <file>" into testsuite/inplace-selinux.sh myself to better visualize the results.

<mock-chroot> sh-4.4# LANG=C ./testsuite/inplace-selinux.sh 
+ fail=0
+ touch a
+ chcon -u system_u a
+ chcon -u user_u a
+ echo 'Hello World'
+ ls -lZ inplace-selinux-file
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 12 Dec  9 04:25 inplace-selinux-file
+ ln -s ./inplace-selinux-file inplace-selinux-link
+ ls -lZ inplace-selinux-file inplace-selinux-link
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 12 Dec  9 04:25 inplace-selinux-file
lrwxrwxrwx. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 22 Dec  9 04:25 inplace-selinux-link -> ./inplace-selinux-file
+ chcon -h -u system_u inplace-selinux-file
+ ls -lZ inplace-selinux-file
-rw-r--r--. 1 root root system_u:object_r:mock_var_lib_t:s0 12 Dec  9 04:25 inplace-selinux-file
+ chcon -h -u user_u inplace-selinux-link
+ ls -lZ inplace-selinux-link
lrwxrwxrwx. 1 root root user_u:object_r:mock_var_lib_t:s0 22 Dec  9 04:25 inplace-selinux-link -> ./inplace-selinux-file
+ echo 'Hello World'
+ ls -lZ inplace-selinux-file2
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 12 Dec  9 04:25 inplace-selinux-file2
+ ln -s ./inplace-selinux-file2 inplace-selinux-link2
+ ls -lZ inplace-selinux-file2 inplace-selinux-link2
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 12 Dec  9 04:25 inplace-selinux-file2
lrwxrwxrwx. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 23 Dec  9 04:25 inplace-selinux-link2 -> ./inplace-selinux-file2
+ chcon -h -u system_u inplace-selinux-file2
+ ls -lZ inplace-selinux-file2
-rw-r--r--. 1 root root system_u:object_r:mock_var_lib_t:s0 12 Dec  9 04:25 inplace-selinux-file2
+ chcon -h -u user_u inplace-selinux-link2
+ ls -lZ inplace-selinux-link2
lrwxrwxrwx. 1 root root user_u:object_r:mock_var_lib_t:s0 23 Dec  9 04:25 inplace-selinux-link2 -> ./inplace-selinux-file2
+ sed -i -e s~Hello~Hi~ inplace-selinux-link
+ ls -lZ inplace-selinux-link
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 9 Dec  9 04:25 inplace-selinux-link
+ sed -i --follow-symlinks -e s~Hello~Hi~ inplace-selinux-link2
+ ls -lZ inplace-selinux-link2
lrwxrwxrwx. 1 root root user_u:object_r:mock_var_lib_t:s0 23 Dec  9 04:25 inplace-selinux-link2 -> ./inplace-selinux-file2
+ ls -Z inplace-selinux-link
+ grep user_u:
+ fail=1
+ ls -lZ inplace-selinux-link
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 9 Dec  9 04:25 inplace-selinux-link
+ ls -Z inplace-selinux-file2
+ grep system_u:
+ fail=1
+ ls -lZ inplace-selinux-file2
-rw-r--r--. 1 root root unconfined_u:object_r:mock_var_lib_t:s0 9 Dec  9 04:25 inplace-selinux-file2
+ Exit 1
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ :
+ test '' = yes
+ cd /builddir/build/BUILD/sed-4.5
+ chmod -R u+rwx /builddir/build/BUILD/sed-4.5/gt-inplace-selinux.sh.b79Z
+ rm -rf /builddir/build/BUILD/sed-4.5/gt-inplace-selinux.sh.b79Z
+ exit 1
<mock-chroot> sh-4.4# 

Expected results:
No failure of testsuite/inplace-selinux.sh during %check

Comment 1 Robert Scheck 2020-12-09 03:34:12 UTC
Btw, source has been taken from https://git.centos.org/rpms/sed/blob/c8s/f/SPECS/sed.spec

Comment 5 Robert Scheck 2021-10-06 09:50:14 UTC
Depending on what the fix exactly is (can't see it in CentOS 8 Stream, yet), will it also land in Fedora Rawhide and CentOS 9 Stream?

Comment 9 errata-xmlrpc 2022-05-10 15:16:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sed bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:1996