From: Derrick Stolee Date: Mon, 09 Nov 2026 13:39:45 GMT Subject: Re: [PATCH 04/15] bundle-uri: handle NULL value for fetch.bundleCreationToken Message-ID: <015c2692-0370-49d9-b055-d86301c8138e@gmail.com> In-Reply-To: <4eb7085084b880f90705799d523ab554fd1cabd3.1794040968.git.gitgitgadget@gmail.com> On 11/7/2026 3:42 AM, Thomas Bachem via GitGitGadget wrote: > From: Thomas Bachem > > A fetch.bundleCreationToken without a value makes "git fetch" and > "git clone --bundle-uri" segfault when the bundle list uses the > creationToken heuristic: fetch_bundles_by_token() passes the NULL > value to sscanf(). > > The function already treats a token that does not parse as 0, as if > no bundles had been fetched before, so it downloads them and then > stores the new token. Treat a missing value the same way. I agree that this is the correct fallback. > - if (sscanf(creationTokenStr, "%"PRIu64, &maxCreationToken) != 1) > + if (!creationTokenStr || > + sscanf(creationTokenStr, "%"PRIu64, &maxCreationToken) != 1) > maxCreationToken = 0; Good. > +test_expect_success 'fetch treats fetch.bundleCreationToken without a value as 0' ' > + test_when_finished "rm -rf token-without-value" && > + cat >bundle-list <<-EOF && > + [bundle] > + version = 1 > + mode = all > + heuristic = creationToken > + > + [bundle "bundle-1"] > + uri = file://$(pwd)/clone-from/bundle-1.bundle > + creationToken = 1 > + EOF I looked at your patches out-of-order, and you have some later ones that focus on this bundle list having bad values. However, the real test is in the fetch: > + git clone --no-local clone-from token-without-value && > + git -C token-without-value \ > + -c fetch.bundleURI="file://$(pwd)/bundle-list" \ > + -c fetch.bundleCreationToken fetch origin && Here, the local creation token is NULL and that causes the problem. > + test_cmp_config -C token-without-value 1 fetch.bundlecreationtoken > +' > + Thanks, -Stolee