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

[PATCH] Define a version of lstat(2) with posix semantics

From
Alex Riesen <raa.lkml@gmail.com>
Date
Mar 19, 2009, 10:27 UTC
Message-ID
<81b0412b0903190327l7745bf01i479fb84fae777af0@mail.gmail.com>

So that Cygwin port can continue work around its supporting library and get access to its faked file attributes.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
2009/3/18 Junio C Hamano <gitster@pobox.com>:
> Yuck; that's a bit too ugly for generic code.  Will there be other places
> that this needs to be used?  If so, we'd probably need to encourage its
> use where appropriate, which is even uglier but we cannot avoid it...

You are damn right! I suggest providing posix_lstat, which has the posix semantics regarding x-bit in st_mode. Maybe even posix_stat is need, too.

There are other places which went broken recently in this regard (lstat cache patches?). Some will have to use this posix_lstat (the copy_templates_1), the others have to get a careful core.filemode handling (like check_remove in diff-lib.c, which isn't just about removed files).

 git-compat-util.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
From b0e3710e7e60d8f81bf252ff9987e17ece4a3be3 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Thu, 19 Mar 2009 11:17:01 +0100
Subject: [PATCH] Define a version of lstat(2) with posix semantics

So that Cygwin port can continue work around its supporting library and get access to its faked file attributes.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 git-compat-util.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 1906253..2401f84 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -85,11 +85,16 @@
 #undef _XOPEN_SOURCE
 #include <grp.h>
 #define _XOPEN_SOURCE 600
+static inline int posix_lstat(const char *file_name, struct stat *buf)
+{
+	return lstat(file_name, buf);
+}
 #include "compat/cygwin.h"
 #else
 #undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
 #include <grp.h>
 #define _ALL_SOURCE 1
+#define posix_lstat lstat
 #endif
 #else 	/* __MINGW32__ */
 /* pull in Windows compatibility stuff */
-- 
1.6.2.142.gaf8db
Next: Johannes Schindelin
Message 1 of 13 in “Define a version of lstat(2) with posix semantics”
  1. Define a version of lstat(2) with posix semanticsAlex Riesen, Mar 19, 2009
  2. Johannes SchindelinMar 19, 2009
  3. Alex RiesenMar 19, 2009
  4. git clone needs to know executability of template filesAlex Riesen, Mar 19, 2009
  5. Johannes SchindelinMar 19, 2009
  6. Alex RiesenMar 20, 2009
  7. Johannes SchindelinMar 20, 2009
  8. Alex RiesenMar 20, 2009
  9. Rogan DawesMar 20, 2009
  10. Alex RiesenMar 20, 2009
  11. Johannes SchindelinMar 20, 2009
  12. Alex RiesenMar 20, 2009
  13. Junio C HamanoMar 19, 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.