Thread View: linux.kernel.git
1 messages
1 total messages
Started by Aniket Gupta
Tue, 03 Nov 2026 15:55
Re: [PATCH] bundle-uri: do not die on unresolvable relative URIs
Author: Aniket Gupta
Date: Tue, 03 Nov 2026 15:55
Date: Tue, 03 Nov 2026 15:55
70 lines
13433 bytes
13433 bytes
On Tue, Nov 03, 2026 at 02:04:49PM +0100, Patrick Steinhardt wrote:
> 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.
> > + 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.
> > - [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.
> > + 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads