🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2244

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

#2244
From: Aniket Gupta
Date: Tue, 03 Nov 2026 15:55
70 lines
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.
Technical Details
Message-ID: <20261103155600.454-1-aniketgupta3001@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74316-linux-kernel-git=dewy.ru
References: <aunb6OjWKWLyl-mp@pks.im>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74316-linux-kernel-git=dewy.ru
From: aniketgupta3001@gmail.com (Aniket Gupta)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] bundle-uri: do not die on unresolvable relative URIs
Date: Tue,  3 Nov 2026 15:55:59 +0000
Organization: Usenet Network
Message-ID: <20261103155600.454-1-aniketgupta3001@gmail.com>
References: <aunb6OjWKWLyl-mp@pks.im>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3223045"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:u3/jzDB0TlzHuPCxOCLTMMKSIDw= sha256:hyFbinW7JUD31mv4otiVCbVmknjFE2R3Te30l+4XLaY=
	sha1:3ez2YuGEIceQads3sf1MOyk1oaM= sha256:Nx5TvpR6KJ9j3izcYl5dVe5NrFZwHKH3KWv8iqEisEQ=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 766FE112978; Tue,  3 Nov 2026 20:44:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id OUaspyKcBl6U;
	Tue,  3 Nov 2026 20:44:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=git+bounces-74316-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 6FC7E112971; Tue,  3 Nov 2026 20:44:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 1A7633E0F9; Tue,  3 Nov 2026 15:57:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793721367;
	b=LtwTK8GpIgz9LeVjrWO+Vnmn3amszySw+AuvGXd+hzWvlut9dSp6MddZAI5ChgHOhAE4
	 oQwF4T3+wPB4oMDFqbo4AgRA1U2WYbp/zALdFcrR7XFRJaxrRi115Yowvo7giA/M4bLaP
	 oKgEW48TpvTrIR0RAXZusGx+ZWe/+zj7azjfaZ/g+8ecbJx+p0nqz3CBmnXAJRcwf6+MX
	 1DbP59ckvK0VakAlUx7zIhspSivRcG/7YTQb+bRwS23acQQ/lZnxHrRDZm01DHE1SaTgI
	 MR3Ripa6BGH4fvjLWJKqrxf58M6smOmbLZBjc13hOrwLC4Do2SNihE1hn+ITCkZUhhg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793721367;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=kedwJpFlJPXeQbBllxWbVJqREFypaXURx/Rxi0ZPICM=;
	b=lXkLPAvTjv1UooNhqT70oCYC8M8JBX6JgIHtyi/pychciemk9wZFmcrHYWIq0YGItSIi
	 +TKnnUZipGfe52x9NUUSF2Aa6CNu6Rd08EKH5Xw8P98A1iZfm5k44hYkWROhm6Mr+LL2G
	 tJEqsFkTruvDFKcsFy8qo3aWDbAOrE171tQxN51lK42i0z6S3PULpyavThy6h168CHmDS
	 5q2SmmtowEWyQ/r0iS91OErfuZguYgHNLYpuNWHxpyXyBmfp2XQhokEY05ortG28g/+GE
	 JagzNqGQP2xjVbRJ2kenjj99+iprdaSW2ftAez/AMNm4ekfZg4jCTIVUC+QjqZSuEeA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pDByy8hB;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 72D00606A329;
	Tue,  3 Nov 2026 15:56:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pDByy8hB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.175
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793721366;
	b=pMtZ/mfrXTbycEaWSa3he9vsKhsVE3RSlJuiWu+BIq95FbdF4W6z0Y/34zUh9YB86RPZ
	 ZIMPqpPvRyA3yLHaUGcC9izJsSUJZObpEUoa0GyGtrvmzb94bqqZsIom3Y/CSOgy9D4+A
	 6kLjYj71GqDxFjKsWJq3BBQ4aTg/oM4MLpI6EV7ojrY/HMs+rCDc2thHyN5aWyMiTAGQC
	 f3JiNvTmbdh+N4ovTlMR1t457Cu+nD8PUo4mzOcVqpDgBgTnFBkDj+/9Ajd/qsddUcAoT
	 y43Z+9Y19SpsfhmDMn1bwYH+tAFEcDLKjqlhDGwDsRHMnULVO70Ixl9T3kUR3PIx9Dw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793721366;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=kedwJpFlJPXeQbBllxWbVJqREFypaXURx/Rxi0ZPICM=;
	b=hwJjyarHWScHN8o2GTUgqGMuskwpx9s3579I49AxJkXVGYDwcQk+MpM4J+60rbYWPHfi
	 33/MQRh1JrtbxVZDuhfWQHT5I7QeSQpZ3dlbFZFYIW7vblFgGjLyW4+W8d3HVCDm/GZ2L
	 l+rajur/7D3ZJFlzpVHU0FKaJSLz65qYzc7VorZiVqRpqRRrTlk09frEg2y57dyiiWWgE
	 91YIyZUUIDBejNYRmIFvfUIFIVoaKLXNmunRVnGpIjdWqG11TJ+JkRhlt4Xcv7ybUldcN
	 fufczTK8y1cx28jYG5OYfPItGUflxom6fQlA7UcsD9VKZvQXnQ2s1uI4d8S/btoBU4g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pDByy8hB;
	arc=none smtp.remote-ip=209.85.210.175
X-Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42562606A324
	for <git@vger.kernel.org>; Tue,  3 Nov 2026 15:56:06 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 42562606A324
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-89f639ba307so1600140b3a.3
        for <git@vger.kernel.org>; Tue, 03 Nov 2026 07:56:06 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793721366; x=1794326166; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=kedwJpFlJPXeQbBllxWbVJqREFypaXURx/Rxi0ZPICM=;
        b=pDByy8hBUpj+q8wb+ez4SgHiyyKmnJfk2in+9WifWIO+uwO88weB5Zf+5zdAUJM485
         Bi5Xk6oHD5mriBQgbqIrxHAsQm+Kdc+173u82BzXAahGt4OoeILTLY/kT1gEBwkF8zY4
         yIv05eKeP1ePEfZZfAeFPNZui6W9yKfgSI6eaYnQ0/3qTRCSUQY4r5F6tb2WFde0VhJs
         k9lcFsVK+zaSGLo1awbKc63e5B8IYHAo02rBSgOTfhiepcS/GjW74FbxO05lqc3ihlPx
         cIYtgueZPDYzlesKrzOdcxM9mNaw1YEY4i6vgLc8tE0k7YXPrr8jtVoFoQF9yd0eMAq5
         JxOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793721366; x=1794326166;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=kedwJpFlJPXeQbBllxWbVJqREFypaXURx/Rxi0ZPICM=;
        b=O1nfnPLbhfQICPrlRSMIf1OUpyjKwlr7urWh9WBtVC1TM8Pil2oUlaETk5DnJBIkz+
         kjyh27awHgH00Weag+lTvXK/HOKHsLliADruDRlxa7g8LQLrItcXTkIEWYW7o3d/WUdS
         zSFALH92r7w3zLDgumQndFGansdiRAXi93VvYRP8Kdgr7gIzWTo5Ggk76Wh+AHqZqNjL
         m4d2wVYjBEqjRPVTwp5cwD+Y+Iyha8A65eQ2ToyGV1Eft6m8RHA0KowDw5bgt/Ld9Fq6
         LhiIsa1bVcL3XIk74CvJ2SPz+jUvWf3iSlT9PWtTITYLlqxx3EMiFV9J0qz6IIHv2mwv
         QxFQ==
X-Gm-Message-State: APuU4Z/bUTwFGjsZOApVdtZBVlJtGtqQi/XwJz2fk0x7UU+AR9B9eIur
	YkJafMEGM212x2cRIqs6W+oVFIRTG//YSlxccKC8LnkOQELEVrybwQ/CaofTQDeTyXU=
X-Gm-Gg: AYBFou23b4sioHLmRV7R957UtzjXGu6eP0hzf56e1odp3/nqdiHYNLFtxRVaiwnHNtT
	Xry5hf58a8iAr+tpr6NUPMota+qYWr37SWHa8BsKvWW1+T8eHVBXORPvLyPxThVkdAVk28OGvda
	cLXp8qIu7utf5sARxEaLXdH0IjsVcyHYmKKAOdFpt1/gy5FntDHomvjoui2xCsx1Sq9VSyC0tX1
	oSPkiXEhoor/+9eI3Dyy3VmeMEROjyFC0ORtP+HyTLAHcarQIGLQUtOcRx+0Km1JANlv0os+Cnd
	jwUv7qgW3OTxIetwCbw+AP04F/0EmgXNLzDIxrZoaPcNNUO359IdqVd2N0jpnrRBrbPwCaE7rVl
	JUdoAf0h810CPOYnjqO23F40HOY4Dog7sbmQ3HNBQ19S8V9JtwUaKCghv004d3tH4Qa9VKdY4tA
	OUa9rRS0Q7nvJYc9sodEomF8p48N6nuQIH9nI5xKyyD/LC8jXDHQaoZJXbVnbzAhE6dZq0pjrGk
	e6p++uCyygBwy54U83HWk3Y9dd+cCzjCeMS/S9PMTtPyuIB1GvPidwpLD37g+QKhUbm/m76qhRj
	0Nh5Va+IutzsdAq7sOdgrCh+M0z5sSKqC5BkdAXYAqfmUhwZUIQzKgVnt9gbtTdwgOXPSKHjIwv
	2rNHc9c3Z2y1u61Q=
X-Received: by 2002:a05:6a00:2347:b0:878:34d7:699a with SMTP id d2e1a72fcca58-8a9bf719fd7mr9777529b3a.42.1793721365479;
        Tue, 03 Nov 2026 07:56:05 -0800 (PST)
X-Received: from LAPTOP-PVRSMPQK.iiitd.edu.in ([103.25.231.125])
        by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8aada3d479dsm3543293b3a.39.2026.11.03.07.56.02
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 03 Nov 2026 07:56:05 -0800 (PST)
X-Cc: git@vger.kernel.org,
	Junio C Hamano <gitster@pobox.com>,
	Derrick Stolee <stolee@gmail.com>
X-Mailer: git-send-email 2.56.0.342.gea0b8383c0.dirty
X-In-Reply-To: <aunb6OjWKWLyl-mp@pks.im>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list