Bug 767568

Summary: restorecon -vF reports changes for unchanged contexts
Product: Red Hat Enterprise Linux 5 Reporter: Karel Volný <kvolny>
Component: policycoreutilsAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NEXTRELEASE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: medium    
Version: 5.8CC: dwalsh, mmalik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-19 15:18:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Karel Volný 2011-12-14 11:29:28 UTC
Description of problem:
Running "restorecon -vF" reports files whose contexts stay unchanged.

Version-Release number of selected component (if applicable):
policycoreutils-1.33.12-14.8.el5

How reproducible:
always

Steps to Reproduce:
1. cd ~
2. touch restorecontest
3. ls -lZ restorecontest 
4. restorecon -vF restorecontest 
5. ls -lZ restorecontest 
  
Actual results:
3. -rw-r--r--  root root root:object_r:user_home_t        restorecontest
4. restorecon reset /root/restorecontest context root:object_r:user_home_t:s0->root:object_r:user_home_t:s0
5. -rw-r--r--  root root root:object_r:user_home_t        restorecontest

Expected results:
3. -rw-r--r--  root root root:object_r:user_home_t        restorecontest
4. (no output)
5. -rw-r--r--  root root root:object_r:user_home_t        restorecontest


Additional info:
you see that restorecon hasn't changed the contexts of the file, the listing says the same in 3. and 5., and from the man page:

       -v     show changes in file labels.
       -F     Force reset of context to match file_context for customizable files, or the user section, if it has changed.


- so the -F option should not touch the file as "if it has changed" doesn't apply, and in addition the -v option should not list the file as there are no changes to show

Comment 1 RHEL Program Management 2011-12-14 11:37:21 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 2 Daniel Walsh 2011-12-14 15:02:20 UTC
I don't see this happening on RHEL6.  But I am not sure it is worth fixing in RHEL5.

Comment 3 Miroslav Grepl 2013-03-19 15:18:41 UTC
It is fixed in RHEL6 so I am closing bug as NEXTRELEASE.