Bug 463883 - The chcon "-c" option does not work as documented
Summary: The chcon "-c" option does not work as documented
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-09-25 04:50 UTC by Murray McAllister
Modified: 2015-01-04 22:35 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-10-08 15:13:29 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Murray McAllister 2008-09-25 04:50:18 UTC
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 05:16:29 UTC
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 13:33:55 UTC
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 15:13:29 UTC
Built without mentioning '-c' option in help and man as coreutils-6.12-13.fc10. Closing RAWHIDE.

Comment 4 Ondrej Vasik 2008-10-08 15:14:37 UTC
(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.