Red Hat Bugzilla – Bug 215373
chgrp alters uid of a file when run on symlinks
Last modified: 2010-10-22 02:55:50 EDT
+++ 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):
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'
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 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.
Created attachment 141083 [details]
Patch correcting behavior of chgrp on symlinks
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.