[NCLUG] Y2k problem in Gnu Tar still?

Michael Dwyer mdwyer at sixthdimension.com
Wed Feb 28 17:57:31 MST 2001


From: "Sean Reifschneider" <jafo at tummy.com>
> The code in question is in src/create.c, and reads:
>
>    && (!after_date_option || current_stat.st_ctime < newer_ctime_option))
>
> I added some debugging and when I ran "tar cf /tmp/foo -N 'Feb 5, 2001'
src",
> the value for newer_ctime_option was 981356400, which corresponds to
> "Mon Feb  5 00:00:00 2001".
>
> Seems like the 1.13.17 of tar works fine.

Gnu doesn't appear to use minor numbers.  So if you download the latest tar
from them, you get 1.13.  Any idea what the .17 means?  Here is what my
debugging found:

# I used "touch -t" to create an arbitrary set of files.
[root at foo test]# ls -la --full-time
total 8
drwxr-xr-x   2 root     root         4096 Wed Feb 28 17:39:54 2001 .
drwxr-xr-x  11 1011     1011         4096 Wed Feb 28 17:39:22 2001 ..
-rw-r--r--   1 root     root            0 Thu Jan 01 00:01:00 2004 future
-rw-r--r--   1 root     root            0 Fri Jan 01 00:01:00 1999 lastyear
-rw-r--r--   1 root     root            0 Wed Feb 28 17:39:30 2001 today

# I ran the freshly-compiled tar with a date a few days ago.  I should pick
up Today and Future.
# It should grab the current directory, as well, I guess...
[root at perjury test]# ../src/tar -cvf /dev/null -N "Feb 20, 2001" .
current_stat.st_mtime = Wed Feb 28 17:39:54 2001
newer_mtime_option = Tue Feb 20 00:00:00 2001
./

current_stat.st_mtime = Fri Jan  1 00:01:00 1999
newer_mtime_option = Tue Feb 20 00:00:00 2001
lastyear

current_stat.st_mtime = Wed Feb 28 17:39:30 2001
newer_mtime_option = Tue Feb 20 00:00:00 2001
today

current_stat.st_mtime = Thu Jan  1 00:01:00 2004
newer_mtime_option = Tue Feb 20 00:00:00 2001
future

Why did it grab LASTYEAR?!  I'm adding in more debugging, since it appears
that TAR checks both the mtime and the ctime when in NEWER mode, but at the
very least, it appears the the date is parsing correctly off the command
line.  Earlier (1.11) tars apparently had problems in the getdate.y stuff...






More information about the NCLUG mailing list