bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#298894: coreutils: chown --dereference changes gid when it shoul


From: Jim Meyering
Subject: Re: Bug#298894: coreutils: chown --dereference changes gid when it shouldn't
Date: Sat, 12 Mar 2005 21:48:03 +0100

"Matthew \"Cheetah\" Gabeler-Lee" <address@hidden> wrote:
> Subject: coreutils: chown --dereference changes gid when it shouldn't
> Version: 5.2.1-2
>
> If one uses chown with --dereference to only set the owner, it incorrectly
> may change the group as well.  It will set the owner of the pointed-to item
> to the owner requested, but then also change the group to the group of the
> symlink.
>
> This happens because chown reads owner and group from the filename passed,
> but then, if --dereference is in effect, runs the chown against the file
> pointed to.  The offending code is in src/chown-core.c, approximately lines
> 211 to 225, and also in the chown_files function.  In dereference mode, it
> needs to not only apply the changes to the dereferenced file, but also to
> read the current ownership from the dereferenced file.

Thanks for the report.
This is fixed upstream, in coreutils-5.3.0.
For reference, here's what I did to show that:

  # touch f
  # chown 1:2 f
  # ln -s f slink
  # ./chown --deref 4 slink
  # stat -c '%g' f; echo
  2
  # /bin/chown --deref 4 slink
  # stat -c '%g' f; echo
  0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]