Date: Thu, 26 Mar 1998 10:48:46 +1100 From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@hub.freebsd.org, syssgm@dtir.qld.gov.au Subject: Re: bin/6124: Getting md5 to reset access times. Message-ID: <199803252348.KAA30982@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
> > If you are using md5 to checksum a load of files you probably > > don't want all the access times changed. This is a small patch > > which adds a "-r" flag which resets the access times to what > > they were before the file was checksumed. > > The updated manual page should point out that resetting the access time > updates the inode change time. This is fundamental - all POSIX syscalls that change the inode update the inode change time. This is well documented in the POSIX.1 and should be documented in the section 2 man pages. utime.2 doesn't even mention the inode change time. Sigh. > For me the inode change time is much > more interesting than the access time since dump checks ctime as well as > mtime to determine if a file has changed, and since hackers leave more > interesting footprints in ctime stamps than atime stamps. I think it's more important for almost everything. The ctime should be used by backup programs. It is the only indication that the inode has changed. Gnu tar has a --atime-preserve option, but it is almost useless since using it clobbers the inode change times. I think the mtree option would be even more useless, since it is more important to have exlusive access to the file systems for security-related things than for tar backups and when you have exclusive access you can mount the file systems -noatime. > Regardless, the utime and utimes manual pages need some updating, which > I'm happy to do once the proper behaviour is defined. > > >+ if( times_ok ) { > >+ TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec); > >+ TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec); > >+ > >+ utimes(argv[optind],tv); > >+ } > > This interesting use of TIMESPEC_TO_TIMEVAL may be of value in the future, > but ffs_update() only uses the tv_sec portion, and throws the rest away. Some file systems actually use the tv_usec or tv_nsec portion. utime.2 says that utime(2) is obsoleted by utimes(2). The reverse is closer to being true (the POSIX utime() is better than the old one). utimes() is useless since it can't preserve tv_nsec and the most important file system throws away even the tv_usec portion. Programs that attempt to preserve timestamps might as well use utime() to be standard and honestly broken. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803252348.KAA30982>