]> Savannah Git Hosting - gnulib.git/commit
stat-time: fix macOS bug with negative file times
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Dec 2023 19:15:56 +0000 (11:15 -0800)
committerBruno Haible <bruno@clisp.org>
Thu, 18 Jan 2024 08:09:04 +0000 (09:09 +0100)
commit97f636ccd01ea7f89e93ca52a8ab582cb3789f95
tree6b9dfcad4e3810db4f9379d9ced8facd8eabf52b
parent22967361bee9e69569a4871bf2476a5d52d4d251
stat-time: fix macOS bug with negative file times

macOS has a bug similar (but not identical) to Solaris when
file timestamps are negative: tv_nsec might go negative.
Problem reported on Darwin 8.11.0 for GNU Tar by Gordon Steemson in:
https://lists.gnu.org/r/bug-tar/2023-12/msg00001.html
This was evidently Mac OS X 10.4.11; I reproduced it on
Darwin 21.6.0 (macOS 12.5).
* lib/stat-time.h (STAT_TIMESPEC_OFFSETOF): New macro.
(stat_time_normalize): Also normalize timestamps on macOS.
* m4/fstat.m4 (gl_FUNC_FSTAT):
* m4/fstatat.m4 (gl_FUNC_FSTATAT):
* m4/lstat.m4 (gl_FUNC_LSTAT):
* m4/stat.m4 (gl_FUNC_STAT):
Also replace on macOS.
ChangeLog
doc/posix-functions/fstat.texi
doc/posix-functions/fstatat.texi
doc/posix-functions/lstat.texi
doc/posix-functions/stat.texi
lib/stat-time.h
m4/fstat.m4
m4/fstatat.m4
m4/lstat.m4
m4/stat.m4