git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Brown paper bag fix for MinGW 64-bit stat

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 7, 2009, 14:37 UTC
Message-ID
<03fcab37c921f5728deded11c07bdf32a263b79b.1236436185u.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1236436185u.git.johannes.schindelin@gmx.de>

When overriding the identifier "stat" so that "struct stat" will be substituted with "struct _stati64" everywhere, I tried to fix the calls to the _function_ stat(), too, but I forgot to change the earlier attempt "stat64" to "_stati64" there.

So, the stat() calls were overridden by calls to _stati64() instead.

Unfortunately, there is a function _stati64() so that I missed that calls to stat() were not actually overridden by calls to mingw_lstat(), but t4200-rerere.sh showed the error.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	Aaargh.
	I am very, very sorry.
	Actually, it was quite funny that t4200 displayed the bug; I 
	_guess_ it was due to a time zone issue, as the times were exactly 
	one hour off (and the machine I tested on is at UTC+0100 right now).
	And due to that bug, "rerere gc" would not collect the garbage.
	So even if the C runtime provides a _stati64() function that 
	pretends to work, it does not, and this patch is absolutely necessary.
	Now, if only the tests would not take ages to run on Windows...  
	then I would not be tempted to skip them when sending the next patches.
 compat/mingw.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 92fb310..a0b74fb 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -169,7 +169,7 @@ int mingw_lstat(const char *file_name, struct stat *buf);
 int mingw_fstat(int fd, struct stat *buf);
 #define fstat mingw_fstat
 #define lstat mingw_lstat
-#define stat64(x,y) mingw_lstat(x,y)
+#define _stati64(x,y) mingw_lstat(x,y)
 
 int mingw_utime(const char *file_name, const struct utimbuf *times);
 #define utime mingw_utime
-- 
1.6.2.327.g0fa6c
Next: Johannes Sixt
Message 1 of 4 in “Brown paper bag fix for MinGW 64-bit stat”
  1. Brown paper bag fix for MinGW 64-bit statJohannes Schindelin, Mar 7, 2009
  2. Johannes SixtMar 7, 2009
  3. Junio C HamanoMar 7, 2009
  4. Johannes SchindelinMar 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.