Article View: linux.kernel.git
Article #2511Re: [PATCH v3 3/3] bundle-uri: do not die on unresolvable relative URIs
From: Derrick Stolee
Date: Fri, 06 Nov 2026 14:51
Date: Fri, 06 Nov 2026 14:51
92 lines
14360 bytes
14360 bytes
On 11/5/2026 10:28 AM, Aniket Gupta wrote:
> A bundle list, either advertised by a server or given to "git clone
> --bundle-uri", may contain relative URIs. They are resolved with
> relative_url(), which calls die() when there are more "../" components
> than the base can absorb, so one bad entry aborts the whole clone.
>
> Resolve them with relative_url_gently() instead. When that fails,
> bundle_list_update() reports the problem as an error and leaves the
> bundle without a URI. The download code already skips such a bundle,
> so the clone carries on with the others.
>
> This resolves the TODO in t5750, so update the test to match.
This TODO was added in ebc39479558 (bundle-uri: allow relative URLs
in bundle lists, 2022-12-22) by _me_, so clearly I thought that this
was a good change at the time. I should retract my concerns about
the change from patch 1.
The only thing that is different now is that the feature has existed
for a while, so maybe some depend on this behavior that we're
changing. That's unlikely to be important.
So I'll officially say: thanks for contributing this cleanup!
> @@ -210,9 +210,17 @@ static int bundle_list_update(const char *key, const char *value,
> strbuf_release(&id);
>
> if (!strcmp(subkey, "uri")) {
> + struct strbuf err = STRBUF_INIT;
> +
> if (bundle->uri)
> return -1;
> - bundle->uri = relative_url(list->baseURI, value, NULL);
> + bundle->uri = relative_url_gently(list->baseURI, value, NULL,
> + &err);
> + if (!bundle->uri) {
> + error("%s", err.buf);
> + strbuf_release(&err);
> + return -1;
> + }
> return 0;
> }
>
> diff --git a/t/t5750-bundle-uri-parse.sh b/t/t5750-bundle-uri-parse.sh
> index 70ae94c4d0..8abf8f31ae 100755
> --- a/t/t5750-bundle-uri-parse.sh
> +++ b/t/t5750-bundle-uri-parse.sh
> @@ -68,17 +68,16 @@ test_expect_success 'bundle_uri_parse_line(): relative URIs and parent paths' '
> uri = <uri>/bundle.bdl
> [bundle "two"]
> uri = bundle.bdl
> - [bundle "three"]
> - uri = <uri>/../bundle.bdl
> EOF
In the context of this diff, this looks like you are removing the
bad input, but this is actually the expected output of the test-tool.
The input is a few lines earlier:
cat >in <<-\EOF &&
bundle.one.uri=bundle.bdl
bundle.two.uri=../bundle.bdl
bundle.three.uri=../../bundle.bdl
EOF
>
> - # TODO: We would prefer if parsing a bundle list would not cause
> - # a die() and instead would give a warning and allow the rest of
> - # a Git command to continue. This test_must_fail is necessary for
> - # now until the interface for relative_url() allows for reporting
> - # an error instead of die()ing.
> + cat >err.expect <<-\EOF &&
> + error: cannot strip one component off url '\''<uri>'\''
> + error: bad line: '\''bundle.three.uri=../../bundle.bdl'\''
> + EOF
> +
But this err.expect matches.
> test_must_fail test-tool bundle-uri parse-key-values in >actual 2>err &&
> - test_grep "fatal: cannot strip one component off url" err
> + test_cmp err.expect err &&
> + test_cmp_config_output expect actual
And now we're actually seeing the list match the expectation (minus
the broken item).
LGTM.
Thanks,
-Stolee
Technical Details
Message-ID:
<0ad84940-b107-4015-849b-f91f1e4ac1d3@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-74678-linux-kernel-git=dewy.ruReferences:
<20261105152842.566318-1-aniketgupta3001@gmail.com> <20261105152842.566318-4-aniketgupta3001@gmail.com>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-74678-linux-kernel-git=dewy.ru
From: stolee@gmail.com (Derrick Stolee)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v3 3/3] bundle-uri: do not die on unresolvable relative
URIs
Date: Fri, 6 Nov 2026 09:51:25 -0500
Organization: Usenet Network
Message-ID: <0ad84940-b107-4015-849b-f91f1e4ac1d3@gmail.com>
References: <20261105152842.566318-1-aniketgupta3001@gmail.com>
<20261105152842.566318-4-aniketgupta3001@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="3905454"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QCueJoUY8Yt0YHlPNP4xO74mqZA= sha256:2vaOK19hzIW61jV23yMtbHv9wCoaPax8NFzkEx/jYqg=
sha1:CqbEGHNcooF5hVTaE4hwXUD3CZs= sha256:NiMk12GN6Wj7P2mByBxjNaLNC04BKqpuUO3XIxViZ2o=
Content-Language: en-US
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 ABEFF113285; Fri, 6 Nov 2026 17:51:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
tests=[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 FRXQDv2Ws3-g;
Fri, 6 Nov 2026 17:51:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-74678-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id B47AE113282; Fri, 6 Nov 2026 17:51:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 9AC77601A80; Fri, 6 Nov 2026 14:51:30 +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=1793976689;
b=DBKerR8mXuJomo87wXhAkYNZ2AQckTHzKvj/9cVCoLu01DNEv4HqOxnvegiirMb/kXTl
egBgHeYlh8+cTutUqFr+wHWzvFpjnBu8e/iNRZS1ppAo091E/+zU5ylYFS1oLl93i4PZq
2WUJWsZJKjOOUuwGm+eMl6HBeuDM2o3HD9FqhLFwwpsDXCtjblZsjnf4EVG1aicANA1jM
X6cExTNsD5TnykfQqz3fyjdcPgc/2caJEM/5+DN3WcNXqK+VJpIfOs1TDsRcoAz7NFhN5
L9sYB2L6/kCevztcemZ3hQuXOQ1oixKaMvGWGaVlth1m62IcGIUGe5hsHYYnErr/7rw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793976689;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=rCuirL97yZZLnBO5Y1xZcCivORfOw9CTHiyk2LjCJF8=;
b=nJarFdVs5IQ8ZsvYNc60jZ78Tahs53XxCV8y6JiBFyyyemv3lCPybTyMCB5BRYurVNjL
E8GTf8UL5J29jMr1xrLTC614fGffU6H597pzzblvt1YuHanrtp9R9a58TIALx7X3iIFpJ
kvrXFRF5zqRzTPGU6MXoXsNYyrk/plfkrDkGrQDRdLkezQfM65tsDCJAGLJrPMLLJGMcY
0KBOsst455daySrpL06hzRVwsURWSrY9xVDGwO5WiTNpPwLVR/66S2EWKatj+eRUiHLxY
/xIppSPWllIsepWFLSfqkZdL059UwhalVCIbgTRsUsrZdPDjYgGqGy1DiaIJI0mlDmA==
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=uynD+mhe;
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 B4575606A32D;
Fri, 6 Nov 2026 14:51:29 +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=uynD+mhe
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.173
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793976688;
b=3qKa8m0PZGmk9RDA8jauoFYDer+2zVj581fHZnjnC2/S0gHdtaH5sSnoRKrbLnLl/Zuq
ad6WGwlk/00jKNKmr3jiTZwJL2yDrCZmN/MyvW1qnFhvXJoQ0mO6uBiP/3qzh4wUBMEDW
LiNMrHk7ECHo98P0vZVZRYyUnuLwiGGnFUPZVT1mmlHHQGiMb6AC9iBcqtQpFx66WHXS0
or00bMvbXQMx1G/JlxURthVRJ2OibnoIT5h0ORRybt/80fbo9CImysPlBnbsEbtUp1+ib
1Mz8iA2z0DeHhv03BvvdIIagn+AsuP/nxSJ7lPbud9b3fQsOn5BhA5P7+6Kjx8XLx4g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793976688;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=rCuirL97yZZLnBO5Y1xZcCivORfOw9CTHiyk2LjCJF8=;
b=p7ZvQJOlPUAmKaYKemiQZWbX7LcCY4v6ohHFpPIY4YkhblLPfIQqpg6ws9SYtKy+402q
bRZWxxo/u8Zytkxsy7E57pmhEWYZhGYEhliczx5qSLeJxbRv4Nts6kc5biXbJ/n34n15F
DCgiG16Qu0V5Xh5q1+OYBGLyHYlYzS6IdVdMcRS7OjTnP9kWPsTS/YYB5cwPmnRpjFH7T
LIaV0VPwrR2zxUZMGHvky5iKM18jHmuwHKFnxqgPtC2GFQQIYptH7rsP8eJ0jD41wYN0I
FgsUcflijIx+4Okw7u7jvoceJjXoIknAIAtPxXT5p3y127/FQK9pqPp5ldLt96kOKsw==
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=uynD+mhe;
arc=none smtp.remote-ip=209.85.222.173
X-Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173])
(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 7B597606A326
for <git@vger.kernel.org>; Fri, 6 Nov 2026 14:51:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7B597606A326
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-qk1-f173.google.com with SMTP id af79cd13be357-93f259cdc86so65434485a.3
for <git@vger.kernel.org>; Fri, 06 Nov 2026 06:51:28 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793976687; x=1794581487; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=rCuirL97yZZLnBO5Y1xZcCivORfOw9CTHiyk2LjCJF8=;
b=uynD+mheV3WDCdLZ0fvPB5ZzpRn+5ERJs2YCIgBxWp9/Y/o6e484C3lS6IRmAnFiNh
CpjuClG7Oi/Uu6pN0hqQlXIA8oyRHoIMABkuOvVo5gloyKNDpYco+/vz4orWBRoZdTIJ
iqIqe5ScUL6M36hQWCVbXYhAPsivyJbFeeB6YelE02j2LylZPl8cXhPCV45VzeTuaij5
0AN7Dud0EHs987yY6UFAieORNUAs3fQISNA3/6JP0fe7HBVdm4F896aXSTbf2ZBYQBH6
dDt+rAk1seUmIQOps5d0WeDjo+7XrDV543QQazROnkidaN3VgKSlHuP7Kf19Yn58PnES
WIWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793976687; x=1794581487;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=rCuirL97yZZLnBO5Y1xZcCivORfOw9CTHiyk2LjCJF8=;
b=1QtpgszCaLy/Fk3tL/rAkeRB03Bc7HjG/Oyu/tEmlIomniZa7zVym3h3sWrwUntiD9
Vhf3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OAkmxILb71m6ePbqiTMeLEmJH6yT3Y1eDKE
3xq+Q8dQzL5SeEU2s960afXma6sCgCYlQ9O7wRlfV77brgCFbBORSwqSiT8SvUA/b1vFTU0nD75
epJSnjWwCalptkBsh/wsyXZiPppqkX/+Nm3obwySmFx9NMx0ALjKtEKO+rU7jr+I+IwaNTUK/Ku
xHhfXnr8HcBLE0u2SSyxcCuoLD+gw8EO68ohFlw6Le1/EokkuNIAr/toIddxTFXa5e3ZJ+LohU8
Q==
X-Received: by 2002:a05:620a:2b92:b0:93f:3e45:a419 with SMTP id af79cd13be357-945f3537dbemr388027685a.38.1793976687245;
Fri, 06 Nov 2026 06:51:27 -0800 (PST)
X-Received: from [192.168.1.109] ([136.61.86.144])
by smtp.gmail.com with ESMTPSA id af79cd13be357-945f5a95e82sm157717985a.12.2026.11.06.06.51.25
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Fri, 06 Nov 2026 06:51:26 -0800 (PST)
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
X-User-Agent: Mozilla Thunderbird
X-Cc: Junio C Hamano <gitster@pobox.com>, Patrick Steinhardt <ps@pks.im>
X-In-Reply-To: <20261105152842.566318-4-aniketgupta3001@gmail.com>