Skip to content

Commit d706b69

Browse files
committed
Do not adjust mtime timezone on Windows
PR win32/25302 notes that gdb will crash when trying to "run" even a simple program on Windows. The essential bug here is that the BFD cache can easily be corrupted -- I have sent a separate patch for that. The particular reason that the cache is corrupted on Windows is that gnulib overrides "stat" to make it do timezone adjustment -- but BFD does not use this version of stat. The difference here triggers the latent cache bug, but can also cause other bugs as well; in particular it can cause spurious warnings about source files being newer. This patch simply removes the stat override on mingw, making gnulib and BFD agree. I tested this by backing out the local AdaCore changes to work around this bug and then verifying that I could reproduce it. Then, I applied this patch and verified that "run" works again. 2020-09-08 Tom Tromey <[email protected]> PR win32/25302: * update-gnulib.sh: Apply stat patch. * patches/0001-use-windows-stat: New file. * import/m4/stat.m4: Update. * configure: Rebuild.
1 parent 03b0a45 commit d706b69

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

gnulib/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2020-09-08 Tom Tromey <[email protected]>
2+
3+
PR win32/25302:
4+
* update-gnulib.sh: Apply stat patch.
5+
* patches/0001-use-windows-stat: New file.
6+
* import/m4/stat.m4: Update.
7+
* configure: Rebuild.
8+
19
2020-08-26 Christian Biesinger <[email protected]>
210
Pedro Alves <[email protected]>
311
Joel Brobecker <[email protected]>

gnulib/configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26907,8 +26907,7 @@ $as_echo "#define ssize_t int" >>confdefs.h
2690726907

2690826908
case "$host_os" in
2690926909
mingw*)
26910-
REPLACE_STAT=1
26911-
;;
26910+
;;
2691226911
*)
2691326912
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5
2691426913
$as_echo_n "checking whether stat handles trailing slashes on files... " >&6; }

gnulib/import/m4/stat.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ AC_DEFUN([gl_FUNC_STAT],
1515
mingw*)
1616
dnl On this platform, the original stat() returns st_atime, st_mtime,
1717
dnl st_ctime values that are affected by the time zone.
18-
REPLACE_STAT=1
18+
dnl REPLACE_STAT=1
1919
;;
2020
*)
2121
dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").

gnulib/patches/0001-use-windows-stat

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4
2+
index 46e9abceee7..8ef355f9407 100644
3+
--- a/gnulib/import/m4/stat.m4
4+
+++ b/gnulib/import/m4/stat.m4
5+
@@ -15,7 +15,7 @@ AC_DEFUN([gl_FUNC_STAT],
6+
mingw*)
7+
dnl On this platform, the original stat() returns st_atime, st_mtime,
8+
dnl st_ctime values that are affected by the time zone.
9+
- REPLACE_STAT=1
10+
+ dnl REPLACE_STAT=1
11+
;;
12+
*)
13+
dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").

gnulib/update-gnulib.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ apply_patches ()
173173
fi
174174
}
175175

176+
apply_patches "patches/0001-use-windows-stat"
177+
176178
# Regenerate all necessary files...
177179
aclocal &&
178180
autoconf &&

0 commit comments

Comments
 (0)