misc/118249: moving a directory changes its mtime
lavajoe at gentoo.org
Sun Nov 25 13:40:02 PST 2007
>Synopsis: moving a directory changes its mtime
>Arrival-Date: Sun Nov 25 21:40:01 UTC 2007
>Originator: Joe Peterson
FreeBSD scorpius 6.2-RELEASE FreeBSD Gentoo 6.2-r3 #3: Thu Oct 25 13:00:32 MDT 2007 joe at scorpius:/usr/src/sys-6.2-r3/i386/compile/GENERIC i386
Moving a directory to a different directory changes its "mtime". This behavior seems odd compared with other "Unix" systems (tried on Mac OS X and Linux). Also, moving a file to a different directory does *not* change its mtime, making this behavior inconsistent. Also, it is not typically desirable to touch mtime simply by being moved, which loses track of the last time the dir's contents were actually changed.
mkdir a b
(check timestamps using stat or "ls -ld" and "ls -lcd")
mv b a
(check timestamps again)
Both "a" and "b" will now have new mtime and ctime). It is expected that "a" will have a new mtime and ctime, but only the ctime on "b" should have changed.
More information about the freebsd-bugs