Bug 466653

Summary: "cp -Z" causes an error, and does not change the context
Product: [Fedora] Fedora Reporter: Murray McAllister <mmcallis>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: kdudka, ovasik, twaugh, vdanen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-10-12 12:46:55 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
tests and results of "cp -Z" none

Description Murray McAllister 2008-10-12 01:53:57 EDT
Created attachment 320134 [details]
tests and results of "cp -Z"

Description of problem:
"cp -Z [context] file1 testing/" copies file1 to testing/, but throws an error and does not change the context of "testing/file1", to the context specified with the cp command.

Version-Release number of selected component (if applicable):
* Fedora release 9.92 (Rawhide)
* coreutils-6.12-13.fc10.i386

* policycoreutils-2.0.57-1.fc10.i386
* selinux-policy-3.5.10-3.fc10.noarch
* libselinux-utils-2.0.73-1.fc10.i386
* libselinux-python-2.0.73-1.fc10.i386
* selinux-policy-targeted-3.5.10-3.fc10.noarch
* libselinux-2.0.73-1.fc10.i386

How reproducible:
Always

Steps to Reproduce:
See attached for tests and results on rawhide, Fedora 9, and Red Hat Enterprise Linux 5.2
  
Actual results:
Error and context does not change:

$ ls -Z
-rw-r--r--  root root unconfined_u:object_r:default_t:s0 file1
drwxr-xr-x  root root unconfined_u:object_r:default_t:s0 testing
$ sudo cp -Z unconfined_u:object_r:samba_share_t:s0 file1 testing/
cp: cannot stat `unconfined_u:object_r:samba_share_t:s0': No such file or directory
$ ls -Z testing/
-rw-r--r--  root root unconfined_u:object_r:default_t:s0 file1

Expected results:
No errors, context changes.

Additional info:
* cp --context works as expected on rawhide, Fedora 9, and Red Hat Enterprise Linux 5.2.
* cp -Z works as expected on Red Hat Enterprise Linux 5.2 (see attached for version numbers).
* No AVC denials after using cp -Z.
Comment 1 Ondrej Vasik 2008-10-12 12:46:55 EDT
Thanks for report, fixed in coreutils-6.10-32.fc9 and coreutils-6.12-14.fc10, closing RAWHIDE.