[NCLUG] Y2k problem in Gnu Tar still?

Michael Dwyer mdwyer at sixthdimension.com
Thu Mar 1 15:26:49 MST 2001


> Well, the code again is:
>
>   if ((0 < top_level || !incremental_option)
>       && !S_ISDIR (current_stat.st_mode)
>       && current_stat.st_mtime < newer_mtime_option
>       && (!after_date_option || current_stat.st_ctime <
newer_ctime_option))
>
> "newer_ctime_option" is actually "newer_mtime_option".
>
> I'm thinking that this says that the ctime is important as well as the
mtime.
> But it also looks like incremental_option has to be set, *OR* top_level
> has to be >0.  Not sure what top_level is meant to imply -- it's not
> the directory depth...
>
> Certainly seems to not be working the way I'd expect, but in the places
> where I've used '-N' it has worked fine...

RTMF: tar(1)
   --newer-mtime
    In conjunction with `--newer', tar will only add files whose contents
    have changed (as opposed to just `--newer', which will also back up
    files for which any status information has changed).

It looks to me like --newer-mtime /alone/ will do what I want it to do.  The
docs aren't all that much help.  If I run with just the --newer-mtime flag
(and add more debugging) I get this:

[tar-1.13]# src/tar -cvf /dev/null --newer-mtime "28 Feb 2001" test
current_stat.st_mtime = Wed Feb 28 17:39:54 2001
newer_mtime_option = Wed Feb 28 00:00:00 2001
current_stat.st_ctime = Wed Feb 28 17:39:54 2001
newer_ctime_option = Wed Feb 28 00:00:00 2001
test/ ## Both times newer, this is backed up
current_stat.st_mtime = Fri Jan  1 00:01:00 1999
newer_mtime_option = Wed Feb 28 00:00:00 2001
current_stat.st_ctime = Wed Feb 28 17:39:22 2001
newer_ctime_option = Wed Feb 28 00:00:00 2001
## mtime is older, this isn't backed up. ctime, IS newer ('lastyear')
current_stat.st_mtime = Wed Feb 28 17:39:30 2001
newer_mtime_option = Wed Feb 28 00:00:00 2001
current_stat.st_ctime = Wed Feb 28 17:39:30 2001
newer_ctime_option = Wed Feb 28 00:00:00 2001
test/today ## Both are newer, this is backed up
current_stat.st_mtime = Thu Jan  1 00:01:00 2004
newer_mtime_option = Wed Feb 28 00:00:00 2001
current_stat.st_ctime = Wed Feb 28 17:39:54 2001
newer_ctime_option = Wed Feb 28 00:00:00 2001
test/future ## Both are newer, this is backed up
[tar-1.13]#

I suppose this is more what I wanted it to do.  I suspect, then, that the
other way was acting strange because I have some strange ctimes... (Maybe in
the future?  Time to check the man pages again...) Either way, I think I
have it figured out, and I can stop scaring people with the y2k thing. :)





More information about the NCLUG mailing list