Subject: Bug#497514: coreutils: chmod, chown, and chgrp change ctime even when no change was necessary

From: Jim Meyering <[email-masked]>
Date: Fri, 12 Sep 2008 21:51:04 +0200

Eric Blake <[email-masked]> wrote:
> According to Paul Eggert on 9/11/2008 11:56 AM:
>>
>> As I read the spec, chown and chgrp are explicitly required to make
>> the equivalent of a chown() call, which in turn is required to change
>> the ctime.  However, chmod is not required to make the equivalent of a
>> chmod() call, and there is no requirement in the 'chmod' spec that it
>> change the ctime.  So POSIX allows the optimization for the 'chmod'
>> command, but not for the 'chown' and 'chgrp' commands.
>
> On the other hand, the POSIX spec for chmod(1) mentions that it is
> implementation defined on how it affects alternate access control.  I have
> come to expect on many systems that support ACLs, that 'chmod 755' on a
> file with rwxr-xr-x+ permissions will remove the ACLs.  In other words,
> optimizing away the chmod(2) call because it compares equal to the stat
> information would break this side-effect of clearing ACLs.

That sounds like a good reason to retain the behavior you've come to
value, even if it's not guaranteed or portable, but only via a new
option.  Then we can still change the default to be more efficient.