Re: Inaccurate modification date testing
On 8/14/13 4:41 PM, Jacek Krüger wrote: > 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. Bash-4.3 will use struct timespec and nanosecond granularity if it's available and in struct stat. Bash-4.2 used the traditional time_t members. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Inaccurate modification date testing
2013/8/14 Jacek Krüger > Bash is innacurate when testing modification dates. It ignores fractions > of a second. Is it expected? Coreutils test does it properly. > Looks like that is fixed in 4.3-alpha http://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?h=devel#n554 -- Geir Hauge
Inaccurate modification date testing
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. [kruger@localhost sdl]$ touch a; touch b [kruger@localhost sdl]$ stat a b File: 'a' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fd02h/64770dInode: 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/64770dInode: 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: - [kruger@localhost sdl]$ test b -nt a && echo newer || echo not not [kruger@localhost sdl]$ /usr/bin/test b -nt a && echo newer || echo not newer [kruger@localhost sdl]$ cat /etc/redhat-release Fedora release 19 (Schrödinger’s Cat) [kruger@localhost sdl]$ rpm -q bash coreutils bash-4.2.45-1.fc19.x86_64 coreutils-8.21-11.fc19.x86_64