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

Re: trouble on windows network share

From
Jeff King <peff@peff.net>
Date
Apr 11, 2013, 04:56 UTC
Message-ID
<20130411045646.GB27795@sigill.intra.peff.net>
In-Reply-To
<871B6C10EBEFE342A772D1159D1320853F63DA3D@umechphj.easf.csd.disa.mil>
On Fri, Apr 05, 2013 at 12:44:48PM +0000, Pyeron, Jason J CTR (US) wrote:
> [strace attachment has been removed, email being resent]

I had trouble finding anything interesting in either this, or in the full strace you sent me off-list, mostly because the syscalls are foreign to me (I had hoped to see an strace of the actual Unix-level syscalls, but I guess that is not how cygwin's strace works).

What I really wanted to see was the result of the open, fstat, and mmap calls. The patch below adds some debugging statements that might help.

> It looks like there is a race condition going on, especially since the
> location and message changes.

If it's a race condition between the write and the subsequent read in the same process, then it would be solved by looking at the object later. Does "git cat-file -p 6838761d549cf76033d2e9faf5954e62839eb25d" work, or is the object forever inaccessible?

---
diff --git a/sha1_file.c b/sha1_file.c
index 0ed2398..d40dd9f 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1331,6 +1331,9 @@ void *map_sha1_file(const unsigned char *sha1, unsigned long *size)
 	int fd;
 
 	fd = open_sha1_file(sha1);
+	if (fd < 0)
+		error("unable to open sha1 file for %s: %s",
+		      sha1_to_hex(sha1), strerror(errno));
 	map = NULL;
 	if (fd >= 0) {
 		struct stat st;
@@ -1343,7 +1346,13 @@ void *map_sha1_file(const unsigned char *sha1, unsigned long *size)
 				return NULL;
 			}
 			map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
+			if (!map)
+				error("unable to mmap %s: %s",
+				      sha1_to_hex(sha1), strerror(errno));
 		}
+		else
+			error("unable to fstat %s: %s", sha1_to_hex(sha1),
+			      strerror(errno));
 		close(fd);
 	}
 	return map;
Previous: Pyeron, Jason J CTR (US)Next: deg
Message 4 of 17 in “trouble on windows network share”
  1. Pyeron, Jason J CTR (US)Apr 4, 2013
  2. Jeff KingApr 4, 2013
  3. Pyeron, Jason J CTR (US)Apr 5, 2013
  4. Jeff KingApr 11, 2013
  5. degMay 2, 2013
  6. Thomas RastMay 3, 2013
  7. David GoldfarbMay 4, 2013
  8. Thomas RastMay 6, 2013
  9. David GoldfarbMay 6, 2013
  10. Thomas RastMay 6, 2013
  11. David GoldfarbMay 6, 2013
  12. David GoldfarbMay 6, 2013
  13. Pyeron, Jason J CTR (US)May 6, 2013
  14. David GoldfarbMay 8, 2013
  15. Pyeron, Jason J CTR (US)May 9, 2013
  16. Phil WiffenDec 3, 2013
  17. Pyeron, Jason J CTR (US)Dec 3, 2013

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.