Bug 189890

Summary: patch does not respect SELinux type context on files
Product: Red Hat Enterprise Linux 4 Reporter: Jon Orris <jorris>
Component: patchAssignee: Tim Waugh <twaugh>
Status: CLOSED DUPLICATE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: dwalsh
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: 2006-04-25 15:49:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jon Orris 2006-04-25 15:28:31 UTC
patch-2.5.4-20 on U3.

Description of problem:

patch always changes the context type of a file to tmp_t. Example:

[test@test ~]$ ls -Z test.pl test.diff
-rw-rw-r--  test     test     user_u:object_r:user_home_t      test.diff
-rw-rw-r--  test     test     user_u:object_r:user_home_t      test.pl
[test@test ~]$ patch -p0 test.pl test.diff
patching file test.pl
[test@test ~]$ ls -Z test.pl
-rw-rw-r--  test     test     user_u:object_r:tmp_t            test.pl

This can cause unexpected permssion errors when using the patched file; for
example, if it were a cgi script or libary with type httpd_sys_content_t, the
context change can cause odd permission errors.

Although straightforward to work around, it would be nice if patch would handle
the type cleanup itself.

Comment 1 Tim Waugh 2006-04-25 15:49:47 UTC

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