"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
got-read-pack commit coloring fix
To:
gameoftrees@openbsd.org
Date:
Mon, 4 Aug 2025 17:30:38 +0200

Download raw body.

Thread
  • Stefan Sperling:

    got-read-pack commit coloring fix

Pass an exact copy of queued IDs to got-read-pack during commit coloring.

This ensures that commit painting inside got-read-pack begins with an
exact copy of the object ID list state which the main process has.

ok?

M  libexec/got-read-pack/got-read-pack.c  |  13+  33-

1 file changed, 13 insertions(+), 33 deletions(-)

commit - 58cfb2ec1ed437bf474ca53c28a459adfa8e8c7c
commit + 2bccde005ed70aba1cef6b10e25bf1add9e2440a
blob - 3e11305bebb5cfea0725ac4325aca4c560b97c10
blob + 4e65a3f8939e6541fe568b471a16f36581536485
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -1901,9 +1901,8 @@ commit_painting_request(struct imsg *imsg, struct imsg
 	const struct got_error *err = NULL;
 	size_t datalen;
 	struct got_object_id_queue ids;
-	size_t nkeep = 0, ndrop = 0, nskip = 0;
-	int nids = 0;
-	uintptr_t color;
+	size_t nids;
+	int nqueued = 0, done = 0;
 
 	STAILQ_INIT(&ids);
 
@@ -1911,42 +1910,23 @@ commit_painting_request(struct imsg *imsg, struct imsg
 	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 
-	color = COLOR_KEEP;
-	err = recv_object_id_queue(&nkeep, &ids, (void *)color, NULL, ibuf);
-	if (err)
-		goto done;
-	if (nids + nkeep > INT_MAX) {
-		err = got_error(GOT_ERR_PRIVSEP_LEN);
-		goto done;
+	while (!done) {
+		err = got_privsep_recv_object_id_queue(&done, &ids, &nids, ibuf);
+		if (err)
+			goto done;
+		if (nqueued + nids > INT_MAX) {
+			err = got_error(GOT_ERR_PRIVSEP_LEN);
+			goto done;
+		}
+		nqueued += nids;
 	}
-	nids += nkeep;
 
-	color = COLOR_DROP;
-	err = recv_object_id_queue(&ndrop, &ids, (void *)color, NULL, ibuf);
-	if (err)
-		goto done;
-	if (nids + ndrop > INT_MAX) {
-		err = got_error(GOT_ERR_PRIVSEP_LEN);
-		goto done;
-	}
-	nids += ndrop;
-
-	color = COLOR_SKIP;
-	err = recv_object_id_queue(&nskip, &ids, (void *)color, NULL, ibuf);
-	if (err)
-		goto done;
-	if (nids + nskip > INT_MAX) {
-		err = got_error(GOT_ERR_PRIVSEP_LEN);
-		goto done;
-	}
-	nids += nskip;
-
-	err = paint_commits(&ids, &nids, keep, drop, skip,
+	err = paint_commits(&ids, &nqueued, keep, drop, skip,
 	    pack, packidx, ibuf, objcache);
 	if (err)
 		goto done;
 
-	err = got_privsep_send_painted_commits(ibuf, &ids, &nids, 0, 1);
+	err = got_privsep_send_painted_commits(ibuf, &ids, &nqueued, 0, 1);
 	if (err)
 		goto done;