Hide Forgot
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:
Fixed in policycoreutils-2.0.83-19.16.el6
*** This bug has been marked as a duplicate of bug 740669 ***