bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

--newer-mtime reg. files vs dirs


From: Sipke Visser
Subject: --newer-mtime reg. files vs dirs
Date: Mon, 2 Dec 2002 15:37:21 +0100

Hello,
 
using timestamp comparing options like --newer-mtime, I notice that
directories are handled differently than regular files. Here's some example
output:
 
sffpc16[/var/log] date
Mon Dec  2 15:25:47 CET 2002
sffpc16[/var/log] tar cvf /tmp/foo --newer-mtime='2 days ago'  boot.log boot.log.1 canna
boot.log
tar: boot.log.1: file is unchanged; not dumped
canna/
sffpc16[/var/log] stat boot.log boot.log.1 canna/
  File: "boot.log"
  Size: 0               Blocks: 0          IO Block: 4096   Regular File
Device: 305h/773d       Inode: 303111      Links: 1   
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: Sun Dec  1 04:02:04 2002
Modify: Sun Dec  1 04:02:04 2002
Change: Sun Dec  1 04:02:04 2002
 
  File: "boot.log.1"
  Size: 5379            Blocks: 16         IO Block: 4096   Regular File
Device: 305h/773d       Inode: 304084      Links: 1   
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: Sun Nov 24 04:02:02 2002
Modify: Fri Nov 29 08:52:30 2002
Change: Sun Dec  1 04:02:04 2002
 
  File: "canna/"
  Size: 4096            Blocks: 8          IO Block: 4096   Directory
Device: 305h/773d       Inode: 164641      Links: 2   
Access: (0755/drwxr-xr-x)  Uid: (    1/     bin)   Gid: (    1/     bin)
Access: Mon Dec  2 15:15:18 2002
Modify: Tue Aug  6 13:07:12 2002
Change: Tue Oct 15 16:36:07 2002
So tar thinks that boot.log is newer, which is correct, boot.log.1 is not, which
is also correct, and that canna (directory) is also newer, which is not true, since
is was modified Aug 6 2002.
 
The manual says:
   To be precise, `--after-date=DATE' (`--newer=DATE', `-N DATE')
checks _both_ `mtime' and `ctime' and processes the file if either one
is more recent than DATE, while `--newer-mtime=DATE' only checks
`mtime' and disregards `ctime'.  Neither uses `atime' (the last time the
contents of the file were looked at).
So as far as I understand, tar just looks at the timestamps in the inodes,
therefore not making difference between regular files and other types.
 
Is this a bug or a feature?
 
I'm using tar (GNU tar) 1.13.25 on a Linux/GNU-i386 system.
 
thanks,
sipke

reply via email to

[Prev in Thread] Current Thread [Next in Thread]