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;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to