]> 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)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Dec 2023 19:18:26 +0000 (11:18 -0800)
commit00cf42bb77bb69f680f38e278155a425875cf37b
tree0d5e09642e7a56f158cf169679d381843ca8d9cc
parent811698980f0ba2d975e0e9e7f28a53740df58b1a
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