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.
Description of problem:
This is pretty strange and possibly the underlying reason is somewhere else other than the policycoreutils package. Here is the issue that started appearing in the recent 6.2 nightly trees. If a file is copied with "cp -a $src $dest" , a subsequent restorecon command on the file exits with return code 1, whereas if it's issued on a file copied with "cp $src $dest" it does return with 0.
For example:
# touch aaa.txt && cp ./aaa.txt /usr/local/bin/.
[root@intel-s3eb1-01 install]# ls -lZ /usr/local/bin/aaa.txt
-rw-r--r--. root root unconfined_u:object_r:bin_t:s0 /usr/local/bin/aaa.txt
[root@intel-s3eb1-01 install]# restorecon -v /usr/local/bin/aaa.txt ; echo $?
0
This looks ok. However same sequence of commands where s/cp/cp -a/ :
[root@intel-s3eb1-01 install]# touch bbb.txt && cp -a ./bbb.txt /usr/local/bin/.
[root@intel-s3eb1-01 install]# ls -lZ /usr/local/bin/bbb.txt
-rw-r--r--. root root unconfined_u:object_r:tmp_t:s0 /usr/local/bin/bbb.txt
[root@intel-s3eb1-01 install]# restorecon -v /usr/local/bin/bbb.txt; echo $?
restorecon reset /usr/local/bin/bbb.txt context unconfined_u:object_r:tmp_t:s0->unconfined_u:object_r:bin_t:s0
1
On rhel 6.1 , the same commands return identical exit codes:
[root@dell-pet410-03 ~]# touch aaa.txt && cp ./aaa.txt /usr/local/bin/.
[root@dell-pet410-03 ~]# ls -lZ /usr/local/bin/aaa.txt
-rw-r--r--. root root unconfined_u:object_r:bin_t:s0 /usr/local/bin/aaa.txt
[root@dell-pet410-03 ~]# restorecon -v /usr/local/bin/aaa.txt ; echo $?
0
[root@dell-pet410-03 ~]# touch bbb.txt && cp -a ./bbb.txt /usr/local/bin/.
[root@dell-pet410-03 ~]# ls -lZ /usr/local/bin/bbb.txt
-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 /usr/local/bin/bbb.txt
[root@dell-pet410-03 ~]# restorecon -v /usr/local/bin/bbb.txt ; echo $?
restorecon reset /usr/local/bin/bbb.txt context unconfined_u:object_r:admin_home_t:s0->system_u:object_r:bin_t:s0
0
Version-Release number of selected component (if applicable):
# rpm -q policycoreutils ; cat /etc/redhat-release ; uname -a
policycoreutils-2.0.83-19.15.el6.x86_64
Red Hat Enterprise Linux Server release 6.2 Beta (Santiago)
Linux intel-s3eb1-01.rhts.eng.bos.redhat.com 2.6.32-202.el6.x86_64 #1 SMP Wed Sep 21 15:27:03 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
How reproducible:
Everytime.
Steps to Reproduce:
Create a file, copy to a directory with cp -a , and do restorecon on the new location of the file.
1.
2.
3.
Actual results:
Expected results:
Additional info: