Bug 215373 - chgrp alters uid of a file when run on symlinks
chgrp alters uid of a file when run on symlinks
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: coreutils (Show other bugs)
4.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-13 13:37 EST by Bryn M. Reeves
Modified: 2010-10-22 02:55 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2007-0786
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-15 11:09:13 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch correcting behavior of chgrp on symlinks (1.22 KB, patch)
2006-11-13 13:37 EST, Bryn M. Reeves
no flags Details | Diff

  None (edit)
Description Bryn M. Reeves 2006-11-13 13:37:13 EST
+++ This bug was initially created as a clone of Bug #171422 +++

Description of problem:
chgrp alters the ownership of a file when operating on a symbolic link. The same
behavior was reported in the FC4 coreutils and fixed in FC5 (coreutils-5.93-1).

Version-Release number of selected component (if applicable):
coreutils-5.2.1-31.4

How reproducible:
Always

Steps to Reproduce:
1. create a file owned by user/group 'a'
2. create a symlink to the file owned by user/group 'b'
3. run chgrp on the symlink to change group ownership of the target to 'b'

Actual results:
Both the user & group ownership are assigned to 'b'

The problem happens because chgrp assumes it's OK to stat the argument and
simply propagate the uid to the file it is chgrping (src/chown-core.c:211).

That's OK in most cases but if the ownership of the link & target differ, the
ownership is incorrectly copied from the link to the target.

The FC4 version of this bug (bug 171422) was closed RAWHIDE when FC5 rebased the
package & there have been a large number of changes to this part of coreutils in
the meantime.

The attached patch attempts to take the minimum changes from  5.93 to correct
this behavior; we check if we're operating on a link & re-stat the file to get
the correct ownership.
Comment 1 Bryn M. Reeves 2006-11-13 13:37:14 EST
Created attachment 141083 [details]
Patch correcting behavior of chgrp on symlinks
Comment 16 errata-xmlrpc 2007-11-15 11:09:13 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0786.html

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