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 1100375 - cp -Z does not copy a file when SELinux context is supplied
Summary: cp -Z does not copy a file when SELinux context is supplied
Keywords:
Status: CLOSED DUPLICATE of bug 1084471
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: coreutils
Version: 7.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Ondrej Vasik
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-22 16:53 UTC by Milos Malik
Modified: 2014-05-23 04:54 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-23 04:54:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Milos Malik 2014-05-22 16:53:51 UTC
Description of problem:
 * cp does not work as described in its man page - the destination file is not created at all !

       -Z, --context[=CTX]
              set  SELinux  security  context  of  destination file to default
              type, or to CTX if specified

Version-Release number of selected component (if applicable):
coreutils-debuginfo-8.22-11.el7.x86_64
coreutils-8.22-11.el7.x86_64

How reproducible:
always

Steps to Reproduce:
# rm -f empty-file another-empty-file
# touch empty-file
# ls -Z *empty-file 
-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 empty-file
# cp -Z unconfined_u:object_r:etc_t:s0 empty-file another-empty-file
cp: target ‘another-empty-file’ is not a directory
# echo $?
1
# ls -Z *empty-file 
-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 empty-file
# 

Actual results:
 * the file is not copied

Expected results:
 * the file is copied

Comment 1 Ondrej Vasik 2014-05-23 04:54:47 UTC
This is not a bug - and duplicate of #1084471... this is documented behaviour change - in RHEL6, -Z <something> was used for setting context. In RHEL 7, long option --context has to be used for setting context, and -Z just restores the context of the file. Closing duplicate, as I plan to improve the docs with http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=30acfcab as #1084471 bugfix.

*** This bug has been marked as a duplicate of bug 1084471 ***


Note You need to log in before you can comment on or make changes to this bug.