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

Re: [PATCH] bundle-uri: do not die on unresolvable relative URIs

From
AGAniket Gupta <aniketgupta3001@gmail.com>
Date
Nov 3, 2026, 15:55 UTC
Message-ID
<20261103155600.454-1-aniketgupta3001@gmail.com>
In-Reply-To
<aunb6OjWKWLyl-mp@pks.im>
On Tue, Nov 03, 2026 at 02:04:49PM +0100, Patrick Steinhardt wrote:
Show 7 quoted lines
> On Wed, Oct 28, 2026 at 11:58:18AM +0000, Aniket Gupta wrote:
> > relative_url() calls die() when the relative URL has more "../"
> > components than the remote URL can absorb. bundle_list_update() calls
> > it on URIs taken from a bundle list and a single bad entry takes down
> > the whole command.
>
> Which command?

git clone, with a bundle list from the server or from --bundle-uri. Fetch uses the same code, but I only tried clone.

> > Add relative_url_gently() which returns NULL and records the reason in
> > a strbuf instead of dying. This will keep relative_url() as a wrapper
>
> s/will keep/keeps/. We're in present tense.
Fixed.
> These "bundle lists" are quite abstract here. It would help the reader
> if the commit message briefly mentioned where such a list even comes
> from.
Added.
> Even more importantly though, do we now only print the error and then
> die or do we continue? And if the latter, why is it fine to continue
> even if we have failed to retrieve the bundle? And is it fine to
> continue for both callers of this function?

We continue. The bad entry ends up without a uri and the download code already skips those. I tried both ways of getting a list with a too-deep ../. The clone prints the errors and still finishes.

Show 12 quoted lines
> > +                     chopped = chop_last_dir(&remoteurl, is_relative, err);
> > +                     if (chopped < 0) {
> > +                             free(remoteurl);
> > +                             strbuf_release(&sb);
> > +                             return NULL;
> > +                     }
> > +                     colonsep |= chopped;
>
> The error handling does get a bit unwieldy in this function by now. It
> would have been great to maybe add a preparatory commit where we adapt
> it to have a single unified exit path that releases memory. But I won't
> insist on it.

I'd rather keep this one small. There is only one error path for now, so I left the cleanup out. Happy to send it as a separate patch if you prefer.

Show 5 quoted lines
> > -     [bundle "three"]
> > -             uri = <uri>/../bundle.bdl
>
> Why do we have to drop these lines here? Interestingly, we don't seem to
> use this file at all in this test.

The old expect was never compared because the test only checked for the die(). Now it is compared and the bad bundle is not in it.

Show 6 quoted lines
> > +     error: cannot strip one component off url '\''.'\''
>
> This error message doesn't really look useful to me. In the current form
> the user wouldn't be able to figure out which URL specifically we failed
> to strip. It's a preexisting issue, true, but do we maybe want to fix it
> while at it?

Good point. It names the url now. I strip any user:password from it first so that it doesnt leak credentials.

Previous: Patrick SteinhardtNext: Aniket Gupta
Message 3 of 6 in “bundle-uri: do not die on unresolvable relative URIs”
  1. bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Oct 28, 2026
  2. Patrick SteinhardtNov 3, 2026
  3. Aniket GuptaNov 3, 2026
  4. bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 3, 2026
  5. Patrick SteinhardtNov 5, 2026
  6. Aniket GuptaNov 5, 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.