Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@sambostock
Copy link

@sambostock sambostock commented Dec 18, 2025

Changes since v1:

  • Updated summarize_bundle() to print # uri = (missing) as a
    comment instead of silently omitting the line.

@sambostock
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2134/sambostock/validate-bundle-uri-v1

To fetch this version to local tag pr-git-2134/sambostock/validate-bundle-uri-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2134/sambostock/validate-bundle-uri-v1

@gitgitgadget-git
Copy link

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Sam Bostock via GitGitGadget" <[email protected]> writes:

>  bundle-uri.c                | 22 +++++++++++++++++++++-
>  t/t5750-bundle-uri-parse.sh | 26 ++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+), 1 deletion(-)
>
> diff --git a/bundle-uri.c b/bundle-uri.c
> index 57cccfc6b8..022e2109a6 100644
> --- a/bundle-uri.c
> +++ b/bundle-uri.c
> @@ -89,7 +89,8 @@ static int summarize_bundle(struct remote_bundle_info *info, void *data)
>  {
>  	FILE *fp = data;
>  	fprintf(fp, "[bundle \"%s\"]\n", info->id);
> -	fprintf(fp, "\turi = %s\n", info->uri);
> +	if (info->uri)
> +		fprintf(fp, "\turi = %s\n", info->uri);

All the other code paths error out when info->uri is missing; I can
understand that print_bundle_list() want to keep going as it is
primarily for debugging, but then don't we want to more loudly
report that a mandatory thing info->uri is missing, rather than a
subtle hint that is lack of expected line that shows "uri = ..."?

@sambostock
Copy link
Author

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Sam Bostock via GitGitGadget" <[email protected]> writes:

>  bundle-uri.c                | 22 +++++++++++++++++++++-
>  t/t5750-bundle-uri-parse.sh | 26 ++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+), 1 deletion(-)
>
> diff --git a/bundle-uri.c b/bundle-uri.c
> index 57cccfc6b8..022e2109a6 100644
> --- a/bundle-uri.c
> +++ b/bundle-uri.c
> @@ -89,7 +89,8 @@ static int summarize_bundle(struct remote_bundle_info *info, void *data)
>  {
>  	FILE *fp = data;
>  	fprintf(fp, "[bundle \"%s\"]\n", info->id);
> -	fprintf(fp, "\turi = %s\n", info->uri);
> +	if (info->uri)
> +		fprintf(fp, "\turi = %s\n", info->uri);

All the other code paths error out when info->uri is missing; I can
understand that print_bundle_list() want to keep going as it is
primarily for debugging, but then don't we want to more loudly
report that a mandatory thing info->uri is missing, rather than a
subtle hint that is lack of expected line that shows "uri = ..."?

Good point, I'll update it to print # uri = (missing) as a comment instead.

When a bundle list config file has a typo like 'url' instead of 'uri',
or simply omits the uri field, the bundle entry is created but
bundle->uri remains NULL. This causes a segfault when copy_uri_to_file()
passes the NULL to starts_with().

Signed-off-by: Sam Bostock <[email protected]>
@sambostock
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2134/sambostock/validate-bundle-uri-v2

To fetch this version to local tag pr-git-2134/sambostock/validate-bundle-uri-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2134/sambostock/validate-bundle-uri-v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant