bug-bash
[Top][All Lists]
Advanced

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

Inaccurate modification date testing


From: Jacek Krüger
Subject: Inaccurate modification date testing
Date: Wed, 14 Aug 2013 22:41:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

According to the manual of bash
file1 -nt file2
True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not

Bash is innacurate when testing modification dates. It ignores fractions of a second. Is it expected? Coreutils test does it properly.

address@hidden sdl]$ touch a; touch b
address@hidden sdl]$ stat a b
  File: 'a'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd02h/64770d    Inode: 1577914     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/  kruger)   Gid: ( 1000/ kruger)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2013-08-14 22:28:54.100234174 +0200
Modify: 2013-08-14 22:28:54.100234174 +0200
Change: 2013-08-14 22:28:54.100234174 +0200
 Birth: -
  File: 'b'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd02h/64770d    Inode: 1577915     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/  kruger)   Gid: ( 1000/ kruger)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2013-08-14 22:28:54.101234176 +0200
Modify: 2013-08-14 22:28:54.101234176 +0200
Change: 2013-08-14 22:28:54.101234176 +0200
 Birth: -
address@hidden sdl]$ test b -nt a && echo newer || echo not
not
address@hidden sdl]$ /usr/bin/test b -nt a && echo newer || echo not
newer

address@hidden sdl]$ cat /etc/redhat-release
Fedora release 19 (Schrödinger’s Cat)
address@hidden sdl]$ rpm -q bash coreutils
bash-4.2.45-1.fc19.x86_64
coreutils-8.21-11.fc19.x86_64



reply via email to

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