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

From: Erik Rossen <[email-masked]>
Date: Tue, 02 Sep 2008 11:30:46 +0200

Package: coreutils
Version: 5.97-5.3
Severity: wishlist

It would be nice if chmod (and chown and chgrp) only made changes to
inodes when necessary so as not to change the ctime of files.

I like to use the integrit file integrity-checking program which scans
for changes to mtime and ctime.  I also occasionally set up "fix-perms"
cronjobs that scan directories recursively and fix any mis-configured of
permissions/ownerships.  The problem is that "chmod -R" and company
change the ctimes of all files, not just those that need to be fixed.
This causes excessively long (and useless) file integrity reports.

I could use cfengine to do the same job, but chmod is sometimes much
more convenient.

I have tested Busybox chmod and it suffers from the same behavior.

If unconditionally resetting the ctime of inodes is normal POSIX
behavior for chmod, then this function should be implemented as a option
flag.  If not, can the authors make "change-only-if-necessary" the
default behavior of chmod and company?

Thanks.

-- System Information:
Debian Release: 4.0
  APT prefers oldstable
  APT policy: (991, 'oldstable'), (991, 'stable'), (66, 'oldstable'), (33, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-6-vserver-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages coreutils depends on:
ii  libacl1                2.2.41-1          Access control list shared library
ii  libc6                  2.3.6.ds1-13etch7 GNU C Library: Shared libraries
ii  libselinux1            1.32-3            SELinux shared libraries

coreutils recommends no packages.

-- no debconf information