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

[PATCHv3 9/9] submodule--helper: use parallel processor correctly.

From
Stefan Beller <sbeller@google.com>
Date
Aug 9, 2016, 04:08 UTC
Message-ID
<20160809040811.21408-12-sbeller@google.com>
In-Reply-To
<20160809040811.21408-1-sbeller@google.com>

When developing the prior patches I had a temporary state in which git-clone would segfault, when prepared the call in prepare_to_clone_next_submodule. This lead to the call failing, i.e. in `update_clone_task_finished` the task was scheduled to be tried again. The second call to prepare_to_clone_next_submodule would return 0, as the segfaulted clone did create the .git file already, such that was not considered to need to be cloned again. I was seeing the "BUG: ce was a submodule before?\n" message, which was the correct behavior at the time as my local code was buggy. When trying to debug this failure, I tried to use printing messages into the strbuf that is passed around, but these messages were never printed as the die(..) doesn't flush the `err` strbuf.

When implementing the die() in 665b35ecc (2016-06-09, "submodule--helper: initial clone learns retry logic"), I considered this condition to be a severe condition, which should lead to an immediate abort as we do not trust ourselves any more. However the queued messages in `err` are valuable so let's not toss them out by immediately dieing, but a graceful return.

Another thing to note: The error message itself was missleading. A return value of 0 doesn't indicate the passed in `ce` is not a submodule any more, but just that we do not consider cloning it any more.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/submodule--helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index fc14843..3e40f99 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -815,8 +815,12 @@ static int update_clone_get_next_task(struct child_process *child,
 	if (index < suc->failed_clones_nr) {
 		int *p;
 		ce = suc->failed_clones[index];
-		if (!prepare_to_clone_next_submodule(ce, child, suc, err))
-			die("BUG: ce was a submodule before?");
+		if (!prepare_to_clone_next_submodule(ce, child, suc, err)) {
+			suc->current ++;
+			strbuf_addf(err, "BUG: submodule considered for cloning,"
+				    "doesn't need cloning any more?\n");
+			return 0;
+		}
 		p = xmalloc(sizeof(*p));
 		*p = suc->current;
 		*idx_task_cb = p;
-- 
2.9.2.583.gd6329be.dirty
Previous: Stefan BellerNext: Junio C Hamano
Message 17 of 36 in “[PATCHv2 0/6] git clone: Marry --recursive and --reference”
  1. Stefan BellerAug 9, 2016
  2. 3/9 submodule--helper module-clone: allow multiple referencesStefan Beller, Aug 9, 2016
  3. 1/9 t7408: modernize styleStefan Beller, Aug 9, 2016
  4. Eric SunshineAug 9, 2016
  5. Junio C HamanoAug 9, 2016
  6. Junio C HamanoAug 9, 2016
  7. Stefan BellerAug 9, 2016
  8. Junio C HamanoAug 9, 2016
  9. Eric SunshineAug 9, 2016
  10. 2/9 t7408: merge short tests, factor out testing methodStefan Beller, Aug 9, 2016
  11. Junio C HamanoAug 9, 2016
  12. Stefan BellerAug 9, 2016
  13. 4/9 submodule--helper update-clone: allow multiple referencesStefan Beller, Aug 9, 2016
  14. 5/9 clone: clarify option_reference as requiredStefan Beller, Aug 9, 2016
  15. 5/6 submodule update: add super-reference flagStefan Beller, Aug 9, 2016
  16. 6/6 clone: reference flag is used for submodules as wellStefan Beller, Aug 9, 2016
  17. 9/9 submodule--helper: use parallel processor correctly.Stefan Beller, Aug 9, 2016
  18. Junio C HamanoAug 9, 2016
  19. 8/9 submodule: try alternates when superproject has an alternateStefan Beller, Aug 9, 2016
  20. 7/9 submodule helper: pass through --reference-if-ableStefan Beller, Aug 9, 2016
  21. 6/9 clone: implement optional referencesStefan Beller, Aug 9, 2016
  22. Junio C HamanoAug 9, 2016
  23. Junio C HamanoAug 9, 2016
  24. Stefan BellerAug 9, 2016
  25. Junio C HamanoAug 9, 2016
  26. Jacob KellerAug 9, 2016
  27. Junio C HamanoAug 9, 2016
  28. Stefan BellerAug 9, 2016
  29. Junio C HamanoAug 9, 2016
  30. Junio C HamanoAug 9, 2016
  31. Stefan BellerAug 9, 2016
  32. Junio C HamanoAug 9, 2016
  33. Stefan BellerAug 9, 2016
  34. Junio C HamanoAug 9, 2016
  35. Stefan BellerAug 9, 2016
  36. Junio C HamanoAug 10, 2016

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.