Thread (135 messages) flat view 135 messages, 4 authors, 2021-08-23

Re: [PATCH v9 6/7] refs: explicitly return failure_errno from parse_loose_ref_contents

From: Jonathan Tan <hidden>
Date: 2021-08-13 20:54:55

quoted hunk ↗ jump to hunk
@@ -448,26 +454,28 @@ static int files_read_raw_ref(struct ref_store *ref_store, const char *refname,
 	}
 	strbuf_reset(&sb_contents);
 	if (strbuf_read(&sb_contents, fd, 256) < 0) {
-		int save_errno = errno;
 		close(fd);
-		errno = save_errno;
 		goto out;
 	}
[snip unrelated code]
 out:
-	*failure_errno = errno;
+	if (ret && !myerr)
+		BUG("returning non-zero %d, should have set myerr!", ret);
At $DAYJOB, some people have observed this BUG triggering. Right now I
don't have a consistent reproduction recipe, but we noticed that the
block starting with "if (strbuf_read" quoted above does not set myerr
upon an error, and instead immediately jumps to "out" with ret being -1.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help