]> Savannah Git Hosting - gnulib.git/commit
stat-time: fix macOS bug with negative file times stable-202301
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:14:35 +0000 (09:14 +0100)
commit20932856a6a07f056918d58acd09cea4ba150a52
tree7540b9956b5082aa48f2b49f936e7829061b9bc7
parenta2ab76186dd9f39cf28aa991320b4b8c7c283c9b
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/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