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

Re: [PATCH v2 14/15] bundle-uri: handle NULL values in bundle lists

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Nov 10, 2026, 11:11 UTC
Message-ID
<ac00d92c-bf67-4629-bdd5-41c80d548354@gmail.com>
In-Reply-To
<fb9e63541bd42aff0fb8b51ba79781e0d80e8531.1794296205.git.gitgitgadget@gmail.com>
Hi Thomas
I'll defer to Stolee on what's the best behavior here, but it seems that in a couple of places we're erroring out on a NULL value when we would ignore an invalid value.
On 10/11/2026 07:36, Thomas Bachem via GitGitGadget wrote:
Show 10 quoted lines
> From: Thomas Bachem <mail@thomasbachem.com>
> > diff --git a/bundle-uri.c b/bundle-uri.c
> index 67a717e857..41c817eefb 100644
> --- a/bundle-uri.c
> +++ b/bundle-uri.c> @@ -175,6 +177,9 @@ static int bundle_list_update(const char *key, const char *value,
>   >   		if (!strcmp(subkey, "heuristic")) {
>   			int i;
> +
> +			if (!value)
> +				return config_error_nonbool(key);
Adding a bit more context below shows we ignore unknown heuristics, so do we really want to return an error here?
>   			for (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) {
>   				if (heuristics[i].heuristic &&
>   				    heuristics[i].name &&
                                     !strcmp(value, heuristics[i].name)) {
                                         list->heuristic = heuristics[i].heuristic;
                                         return 0;
                                 }
                         }
                         /* Ignore unknown heuristics. */
                         return 0;
Show 8 quoted lines
> @@ -216,6 +223,8 @@ static int bundle_list_update(const char *key, const char *value,
>   	}
>   >   	if (!strcmp(subkey, "creationtoken")) {
> +		if (!value)
> +			return config_error_nonbool(key);
>   		if (sscanf(value, "%"PRIu64, &bundle->creationToken) != 1)
>   			warning(_("could not parse bundle list key %s with value '%s'"),
>   				"creationToken", value);
		return 0;
	}
Here we ignore parse errors, so should we be returning an error on a NULL value?
Thanks
Phillip
Show 24 quoted lines
> diff --git a/t/t5750-bundle-uri-parse.sh b/t/t5750-bundle-uri-parse.sh
> index 70ae94c4d0..a91c1b428d 100755
> --- a/t/t5750-bundle-uri-parse.sh
> +++ b/t/t5750-bundle-uri-parse.sh
> @@ -312,4 +312,20 @@ test_expect_success 'parse config format: bundle with url instead of uri' '
>   	test_grep "bundle '\''typo'\'' has no uri" err
>   '
>   > +test_expect_success 'parse config format edge cases: keys without a value' '
> +	for key in mode heuristic
> +	do
> +		printf "[bundle]\n\tversion = 1\n\t%s\n" "$key" >input &&
> +		test_must_fail test-tool bundle-uri parse-config input 2>err &&
> +		test_grep "missing value for .bundle.$key." err || return 1
> +	done &&
> +	for key in uri creationtoken
> +	do
> +		printf "[bundle]\n\tversion = 1\n\tmode = all\n[bundle \"one\"]\n\t%s\n" \
> +			"$key" >input &&
> +		test_must_fail test-tool bundle-uri parse-config input 2>err &&
> +		test_grep "missing value for .bundle.one.$key." err || return 1
> +	done
> +'
> +
>   test_done
Previous: Thomas Bachem via GitGitGadgetNext: Derrick Stolee
Message 47 of 70 in “Fix segfaults on settings given without a value”
  1. 00/15 Fix segfaults on settings given without a valueThomas Bachem via GitGitGadget, Nov 7, 2026
  2. 01/15 rebase -i: handle NULL value for rebase.missingCommitsCheckThomas Bachem via GitGitGadget, Nov 7, 2026
  3. Phillip WoodNov 9, 2026
  4. Junio C HamanoNov 9, 2026
  5. Thomas BachemNov 9, 2026
  6. 02/15 odb: handle NULL values for core.alternateRefs* configThomas Bachem via GitGitGadget, Nov 7, 2026
  7. 03/15 add-patch: handle NULL value for color slotsThomas Bachem via GitGitGadget, Nov 7, 2026
  8. 04/15 bundle-uri: handle NULL value for fetch.bundleCreationTokenThomas Bachem via GitGitGadget, Nov 7, 2026
  9. Derrick StoleeNov 9, 2026
  10. 05/15 grep: handle NULL value for grep.patternTypeThomas Bachem via GitGitGadget, Nov 7, 2026
  11. 06/15 remote: handle NULL value for remote.<name>.tagOptThomas Bachem via GitGitGadget, Nov 7, 2026
  12. Phillip WoodNov 10, 2026
  13. 07/15 blame: handle NULL values for color.blame.* configThomas Bachem via GitGitGadget, Nov 7, 2026
  14. Phillip WoodNov 10, 2026
  15. 08/15 merge: handle NULL value for branch.<name>.mergeOptionsThomas Bachem via GitGitGadget, Nov 7, 2026
  16. Phillip WoodNov 10, 2026
  17. Junio C HamanoNov 10, 2026
  18. Phillip WoodNov 11, 2026
  19. Ben KnobleNov 11, 2026
  20. Junio C HamanoNov 11, 2026
  21. 09/15 remote: handle NULL value for remotes.<group>Thomas Bachem via GitGitGadget, Nov 7, 2026
  22. 10/15 setup: handle NULL value for safe.bareRepositoryThomas Bachem via GitGitGadget, Nov 7, 2026
  23. 11/15 pseudo-merge: handle NULL value for bitmapPseudoMerge.<name>.patternThomas Bachem via GitGitGadget, Nov 7, 2026
  24. 12/15 scalar: handle NULL value for scalar.repoThomas Bachem via GitGitGadget, Nov 7, 2026
  25. Derrick StoleeNov 9, 2026
  26. 13/15 config: handle NULL value for remote URLs in hasconfig includesThomas Bachem via GitGitGadget, Nov 7, 2026
  27. 14/15 bundle-uri: handle NULL values in bundle listsThomas Bachem via GitGitGadget, Nov 7, 2026
  28. Derrick StoleeNov 9, 2026
  29. 15/15 config: handle NULL values when listing colors and expiry datesThomas Bachem via GitGitGadget, Nov 7, 2026
  30. Derrick StoleeNov 9, 2026
  31. 00/15 Fix segfaults on settings given without a valueThomas Bachem via GitGitGadget, Nov 10, 2026
  32. 01/15 rebase -i: handle NULL value for rebase.missingCommitsCheckThomas Bachem via GitGitGadget, Nov 10, 2026
  33. Phillip WoodNov 10, 2026
  34. 02/15 odb: handle NULL values for core.alternateRefs* configThomas Bachem via GitGitGadget, Nov 10, 2026
  35. 03/15 add-patch: handle NULL value for color slotsThomas Bachem via GitGitGadget, Nov 10, 2026
  36. 04/15 bundle-uri: handle NULL value for fetch.bundleCreationTokenThomas Bachem via GitGitGadget, Nov 10, 2026
  37. 05/15 grep: handle NULL value for grep.patternTypeThomas Bachem via GitGitGadget, Nov 10, 2026
  38. 06/15 remote: handle NULL value for remote.<name>.tagOptThomas Bachem via GitGitGadget, Nov 10, 2026
  39. 07/15 blame: handle NULL values for color.blame.* configThomas Bachem via GitGitGadget, Nov 10, 2026
  40. 08/15 merge: handle NULL value for branch.<name>.mergeOptionsThomas Bachem via GitGitGadget, Nov 10, 2026
  41. 09/15 remote: handle NULL value for remotes.<group>Thomas Bachem via GitGitGadget, Nov 10, 2026
  42. 10/15 setup: handle NULL value for safe.bareRepositoryThomas Bachem via GitGitGadget, Nov 10, 2026
  43. 11/15 pseudo-merge: handle NULL value for bitmapPseudoMerge.<name>.patternThomas Bachem via GitGitGadget, Nov 10, 2026
  44. 12/15 scalar: handle NULL value for scalar.repoThomas Bachem via GitGitGadget, Nov 10, 2026
  45. 13/15 config: handle NULL value for remote URLs in hasconfig includesThomas Bachem via GitGitGadget, Nov 10, 2026
  46. 14/15 bundle-uri: handle NULL values in bundle listsThomas Bachem via GitGitGadget, Nov 10, 2026
  47. Phillip WoodNov 10, 2026
  48. Derrick StoleeNov 10, 2026
  49. 15/15 config: handle NULL values when listing colors and expiry datesThomas Bachem via GitGitGadget, Nov 10, 2026
  50. Phillip WoodNov 10, 2026
  51. Thomas BachemNov 10, 2026
  52. 00/15 Fix segfaults on settings given without a valueThomas Bachem via GitGitGadget, Nov 11, 2026
  53. 01/15 rebase -i: handle NULL value for rebase.missingCommitsCheckThomas Bachem via GitGitGadget, Nov 11, 2026
  54. 02/15 odb: handle NULL values for core.alternateRefs* configThomas Bachem via GitGitGadget, Nov 11, 2026
  55. 03/15 add-patch: handle NULL value for color slotsThomas Bachem via GitGitGadget, Nov 11, 2026
  56. 04/15 bundle-uri: handle NULL value for fetch.bundleCreationTokenThomas Bachem via GitGitGadget, Nov 11, 2026
  57. 05/15 grep: handle NULL value for grep.patternTypeThomas Bachem via GitGitGadget, Nov 11, 2026
  58. 06/15 remote: handle NULL value for remote.<name>.tagOptThomas Bachem via GitGitGadget, Nov 11, 2026
  59. 07/15 blame: handle NULL values for color.blame.* configThomas Bachem via GitGitGadget, Nov 11, 2026
  60. 08/15 merge: handle NULL value for branch.<name>.mergeOptionsThomas Bachem via GitGitGadget, Nov 11, 2026
  61. 09/15 remote: handle NULL value for remotes.<group>Thomas Bachem via GitGitGadget, Nov 11, 2026
  62. 10/15 setup: handle NULL value for safe.bareRepositoryThomas Bachem via GitGitGadget, Nov 11, 2026
  63. 11/15 pseudo-merge: handle NULL value for bitmapPseudoMerge.<name>.patternThomas Bachem via GitGitGadget, Nov 11, 2026
  64. 12/15 scalar: handle NULL value for scalar.repoThomas Bachem via GitGitGadget, Nov 11, 2026
  65. 13/15 config: handle NULL value for remote URLs in hasconfig includesThomas Bachem via GitGitGadget, Nov 11, 2026
  66. 14/15 bundle-uri: handle NULL values in bundle listsThomas Bachem via GitGitGadget, Nov 11, 2026
  67. 15/15 config: handle NULL values when listing colors and expiry datesThomas Bachem via GitGitGadget, Nov 11, 2026
  68. Phillip WoodNov 12, 2026
  69. Derrick StoleeNov 12, 2026
  70. Junio C HamanoNov 12, 2026

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.