Bug 463883 - The chcon "-c" option does not work as documented
The chcon "-c" option does not work as documented
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-25 00:50 EDT by Murray McAllister
Modified: 2015-01-04 17:35 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-10-08 11:13:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Murray McAllister 2008-09-25 00:50:18 EDT
Version-Release number of selected component (if applicable):
* coreutils-6.12-9.fc10.i386
* Fedora release 9.91 (Rawhide)
* kernel-2.6.27-0.352.rc7.git1.fc10.i686

* policycoreutils-2.0.55-8.fc10.i386
* libselinux-2.0.71-4.fc10.i386
* selinux-policy-3.5.7-1.fc10.noarch
* libselinux-python-2.0.71-4.fc10.i386
* selinux-policy-targeted-3.5.7-1.fc10.noarch
* libselinux-utils-2.0.71-4.fc10.i386

# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 23
Policy from config file:        targeted


How reproducible:
Always

Steps to Reproduce:
As the Linux root user:
1. touch /var/www/html/file1
2. ls -Z /var/www/html/file1
-rw-r--r--  root root unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/file1
3. chcon -c -t samba_share_t /var/www/html/file1
  
Actual results:
A "Try `chcon --help' for more information." error.

Context does not change (stays httpd_sys_content_t).

Expected results:
context changed and a "context of /var/www/html/file1 changed to user_u:object_r:samba_share_t" message.

Additional info:

No denial messages. "chcon -v -t samba_share_t /var/www/html/file1" works as expected ("changing security context of `/var/www/html/file1'")

Works as expected on:
* coreutils-5.97-14.el5
* Red Hat Enterprise Linux Client release 5.2 (Tikanga)
* kernel-2.6.18-92.1.1.el5

* policycoreutils-1.33.12-14.el5
* libselinux-devel-1.33.4-5.el5
* libselinux-python-1.33.4-5.el5
* selinux-policy-2.4.6-137.el5
* libselinux-1.33.4-5.el5
* selinux-policy-targeted-2.4.6-137.el5

$ sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted
Comment 1 Murray McAllister 2008-09-25 01:16:29 EDT
Same issue occurs on Fedora 9:

* coreutils-6.10-30.fc9.i386
* Fedora release 9 (Sulphur)
* kernel-2.6.26.3-29.fc9.i686

* policycoreutils-2.0.52-8.fc9.i386
* selinux-policy-targeted-3.3.1-87.fc9.noarch
* selinux-policy-3.3.1-87.fc9.noarch
* libselinux-python-2.0.67-4.fc9.i386
* libselinux-2.0.67-4.fc9.i386
* selinux-policy-devel-3.3.1-87.fc9.noarch

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 23
Policy from config file:        targeted
Comment 2 Ondrej Vasik 2008-10-06 09:33:55 EDT
Thanks for report, after discussing problem with upstream, decision to remove that option from help was made. Source code with support for that option is not implemented in recent upstream version. Will be fixed in next Fedora builds.
(Jim Meyering (upstream maintainer of coreutils) said: FYI, implementing semantics of -c (reliably) is not possible, and adds unnecessary complexity, so I removed it.)
Comment 3 Ondrej Vasik 2008-10-08 11:13:29 EDT
Built without mentioning '-c' option in help and man as coreutils-6.12-13.fc10. Closing RAWHIDE.
Comment 4 Ondrej Vasik 2008-10-08 11:14:37 EDT
(Update for F-9 doing the same thing will be done soon (with other fixes))

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