GNU bug report logs - #71631
[PATCH] swh: Specify 'extid_version' when looking up by external ID.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Simon Tournier <zimon.toutoune@HIDDEN>; Keywords: patch; Done: Ludovic Courtès <ludo@HIDDEN>; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 71631-done <at> debbugs.gnu.org:


Received: (at 71631-done) by debbugs.gnu.org; 11 Jul 2024 09:59:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 11 05:59:38 2024
Received: from localhost ([127.0.0.1]:51093 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sRqaP-00071K-Rh
	for submit <at> debbugs.gnu.org; Thu, 11 Jul 2024 05:59:38 -0400
Received: from mail-lf1-f45.google.com ([209.85.167.45]:38223)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1sRqaL-000713-0V
 for 71631-done <at> debbugs.gnu.org; Thu, 11 Jul 2024 05:59:36 -0400
Received: by mail-lf1-f45.google.com with SMTP id
 2adb3069b0e04-52e9901f858so121194e87.1
 for <71631-done <at> debbugs.gnu.org>; Thu, 11 Jul 2024 02:59:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1720691907; x=1721296707; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=qnINuy0Nz1wfD6xJ1sx/+ajM2JchXDjuiCjsKl7Eo4g=;
 b=i8PqEoL+4G07xA0OKEHRaXCMNJh2dSK5hIyglh+qQ9m5x7Mbm2aYO5z22YpdZv+tR/
 MCYti+8dlIYtF3FigcWG3fINDvyrqWohIM0p1QI++PMrd6fS2soJnXqVRfEMd3vQ7wg0
 SOFLwb+rd0+dbdHr2RD0N1FRjmjom9z3zY/drhns2/aaqTt5HPJ8L5gMxBTg9m0KrO5M
 rDXi+4wnjj7kgdNiPJlMYBH9YMLVqlVsk0eW5Ah6ZHeeme/sKyWfdbS2y4LRwC/SPZ+A
 15i6Xv/WyODLQ/bvQE9JPusGgm8nFrexxTk1MCrkJkQCy9pLti7mAGbGSJVU7wrt+ots
 gIxw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1720691907; x=1721296707;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=qnINuy0Nz1wfD6xJ1sx/+ajM2JchXDjuiCjsKl7Eo4g=;
 b=M0UaYqLSbk1AjIel29ApOlrDQZygNMsX5/lSrMSlLLT8bnzH3/rouY0pB9MLnIyM+8
 6hKBsHoN/7QxCiUpkIYTsEKascD8QoeBT5I1Qsxs1fQel6pw+45k/f/zB0ssetUG9Z5f
 o8qM6Dz0d65wxSBQ6EsrhRPyaeEjdVhvGEER0Mo0XYrS9noXfwI3CQzMy/nDPTLunV1C
 GfNzKpmdLw0VInpHPI8NWxAYf68NQ93qobsOGI8tVvd2uWeqJgFb7j0cLPCfZ23dJIFh
 tYcELRiFJy8ZvIpJX7yqdF21KuEajPwEba2i4AooFlYCLtTCaejNvaBKl3gDZh58YSx3
 sYHg==
X-Forwarded-Encrypted: i=1;
 AJvYcCUJ/FxZH/0fTyM+uF2pVWavBHeBF4bsBoV9GF/ytJkm8VCtApA1mkuDLhP+SQC/owLvlybrf6HMx2fdd70Br7nrJCha9mmCN97EUA==
X-Gm-Message-State: AOJu0YyU+jfjqIFEH6772KbNnyJqh2iczb62CDCOfmGPgSCPEq4OgSMX
 wCycctgzOu8izaKCRdEyyY+ABZSSoSqzL+D9Ik41iE+XAP3xsc5y
X-Google-Smtp-Source: AGHT+IHuSE9UaUr6l0KKfRsBYEGTKNAholhkjBUjwbztFLt5ayj1heogA2c3EYngCkrpND4akvaJVQ==
X-Received: by 2002:a05:6512:3986:b0:52c:dd58:1a97 with SMTP id
 2adb3069b0e04-52ec3fa3669mr1431090e87.5.1720691907038; 
 Thu, 11 Jul 2024 02:58:27 -0700 (PDT)
Received: from lili ([2a01:e0a:59b:9120:a17c:5a42:b196:e92e])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-4266f6f1ff9sm112853095e9.18.2024.07.11.02.58.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 11 Jul 2024 02:58:26 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#71631: [PATCH] swh: Specify 'extid_version' when looking up
 by external ID.
In-Reply-To: <87o77n9xbl.fsf@HIDDEN>
References: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@HIDDEN>
 <87o77n9xbl.fsf@HIDDEN>
Date: Wed, 10 Jul 2024 20:53:37 +0200
Message-ID: <87ttgxf58u.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 71631-done
Cc: Josselin Poiret <dev@HIDDEN>, 71631-done <at> debbugs.gnu.org,
 Mathieu Othacehe <othacehe@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.2 (/)

Hi Ludo,

On Thu, 27 Jun 2024 at 00:02, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

> I pushed it as bd908af0c619cb1b74afeeb07839d7af08de9d91 with a small
> modification: =E2=80=98swh-url=E2=80=99 checks for parameters (the =E2=80=
=9C?param=3Dvalue=E2=80=9D bit)
> rather than =E2=80=9Cextid_version=E2=80=9D specifically.  I also moved t=
he link to the
> issue to =E2=80=98lookup-external-id=E2=80=99.

Thanks.  Indeed your patch is better. :-)

Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#71631; Package guix-patches. Full text available.

Message received at 71631-done <at> debbugs.gnu.org:


Received: (at 71631-done) by debbugs.gnu.org; 26 Jun 2024 22:05:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 26 18:05:22 2024
Received: from localhost ([127.0.0.1]:40507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sMalS-0002iP-Ew
	for submit <at> debbugs.gnu.org; Wed, 26 Jun 2024 18:05:21 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56028)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1sMalQ-0002i6-Kl
 for 71631-done <at> debbugs.gnu.org; Wed, 26 Jun 2024 18:05:17 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1sMajC-00065l-0W; Wed, 26 Jun 2024 18:02:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=T/ymZUUtJ5qIV8d7fDcvIA15rMcTtCfMt3qo0mNnRRo=; b=JI64yEfUTkdSWnJ+4WhA
 knrzJyLd2rPjfFE7g4GoEMjKmnbzM5XQToRHB4VbmMtpgat7uATWUp0BCoWZmbubg0ERzoIKYZ4Bp
 rSTB5iuy0SvGTdraQg3DTN0t2UzVYVaHbzcHrZVtm2oBlIwWHM9d/ofdRpkXAzsF7nWkzSsoGotrO
 wLC99RzdiwWduN2jnwE6kgzDK4usI+Cg6BXARj4EJGQ5iyNfN0VFscSh8kX6RhMj2KHks9W+CSWUd
 8opp1axJivghoSmwmR3nv+92JM3q3Ybbl5rUDQ2FYbeckJIkQesGKH5ncahKMTgFKat4nazrgToFO
 1UIl/g0t54VFDA==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Simon Tournier <zimon.toutoune@HIDDEN>
Subject: Re: [bug#71631] [PATCH] swh: Specify 'extid_version' when looking
 up by external ID.
In-Reply-To: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@HIDDEN>
 (Simon Tournier's message of "Tue, 18 Jun 2024 16:02:51 +0200")
References: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@HIDDEN>
Date: Thu, 27 Jun 2024 00:02:54 +0200
Message-ID: <87o77n9xbl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71631-done
Cc: Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Mathieu Othacehe <othacehe@HIDDEN>, 71631-done <at> debbugs.gnu.org,
 Ricardo Wurmus <rekado@HIDDEN>, Christopher Baines <guix@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Simon Tournier <zimon.toutoune@HIDDEN> skribis:

> Reported in <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>.
>
> * guix/swh.scm (swh-url): Don't redirect when URL contains 'extid_version=
'.
> (lookup-external-id): Specify 'extid_version' avoiding SWH's bug from past
> version.
>
> Change-Id: Iea2a5256e0612dae95567907bb11edb92a50df73
> ---
>  guix/swh.scm | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> Hi,
>
> Without the patch:
>
>     $ guix repl
>     scheme@(guix-user)> (use-modules (guix swh) (gnu packages guile-xyz))
>     scheme@(guix-user)> (lookup-directory-by-nar-hash
>                           (content-hash-value (origin-hash (package-sourc=
e guile-wisp))) 'sha256)
>     $1 =3D "swh:1:dir:218d95849f10fc0691d7dfa80999ce5061e654ef"
>
> This is incorrect.  As explained in:
>
>     https://gitlab.softwareheritage.org/swh/meta/-/issues/5093
>
> The mismatch comes from something unexpected on SWH side.  That had been
> corrected and the way to access to the fix is to update the version; henc=
e the
> patch.
>
>     $ ./pre-inst-env guix repl
>     scheme@(guix-user)> (use-modules (guix swh) (gnu packages guile-xyz))
>     scheme@(guix-user)> (lookup-directory-by-nar-hash
>                           (content-hash-value (origin-hash (package-sourc=
e guile-wisp))) 'sha256)
>     $1 =3D "swh:1:dir:1f35a460673e2c8ccf948b8c18cb8c18d2ec24fe"

Woow.

I pushed it as bd908af0c619cb1b74afeeb07839d7af08de9d91 with a small
modification: =E2=80=98swh-url=E2=80=99 checks for parameters (the =E2=80=
=9C?param=3Dvalue=E2=80=9D bit)
rather than =E2=80=9Cextid_version=E2=80=9D specifically.  I also moved the=
 link to the
issue to =E2=80=98lookup-external-id=E2=80=99.

Thank you!

Ludo=E2=80=99.




Notification sent to Simon Tournier <zimon.toutoune@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Ludovic Courtès <ludo@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 71631 <at> debbugs.gnu.org:


Received: (at 71631) by debbugs.gnu.org; 18 Jun 2024 15:08:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 11:08:50 2024
Received: from localhost ([127.0.0.1]:43882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJaS2-0003Ju-Dr
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 11:08:50 -0400
Received: from mail-lf1-f49.google.com ([209.85.167.49]:40411)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1sJaS0-0003Jh-37
 for 71631 <at> debbugs.gnu.org; Tue, 18 Jun 2024 11:08:48 -0400
Received: by mail-lf1-f49.google.com with SMTP id
 2adb3069b0e04-52ca9e52d5dso435479e87.1
 for <71631 <at> debbugs.gnu.org>; Tue, 18 Jun 2024 08:08:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1718723259; x=1719328059; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=AHg+d9rKB1Us48QZU9XX1TZKCBBtmWQVAlKfVZIN+TY=;
 b=abWxrfw2iK8Y24ZlZ56NI9anlgB5V4AIMA1euJw4AOO/Qla4i7MCupvzovjzAKQaie
 4T7v52qstss40zZtzZL36e9j4pJnrIzJMFmlllUVwL1w54+KOHCQ5jctEl0qGdX+gaN8
 d5H2nVx8HbCIcTUXvX/xaw2uA+Fwr5gtfcgwf5pu2oQ2spGuStGeZd4h3JcPFbKmL6Qa
 5z2nhLT1JJ5VKRaHuClgarn5cEDzVLL8pJK/KsZugHW7BElrU1B6TPr3osX1WoZ0/gzf
 ugJM7QTdNLIxDH/wTS0VH1qkXH1hq4spMn1lQep4yef22TsPIQHrGtx9lTv4qVQtOcdJ
 Vs7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1718723259; x=1719328059;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=AHg+d9rKB1Us48QZU9XX1TZKCBBtmWQVAlKfVZIN+TY=;
 b=ROasVIiIy8cSVh03ltEfeJBQ6/cU0+o1OoblbJ2znrxjZA1SEHG3q1mPC/MzJNhCIo
 clYn89ZPx73hDYtKrjalTSjZ6uzEN27LPJEUHHB+S8Mie+QXyzC2MUmfFSOclrN5R/xN
 jbnJmhHO5gd8MGDQ907++12+Mka+fpBfa+wQ4wKdSkuMMWnRJK5dBzpTHW7ut9nxGJ8A
 tdwt1+nHRgQThLcTS5RBBOZ1kMTHN8tpfgSCdbR3eSPBbDiiZ7YhDjDQCbqjaYNOYX3h
 sl5SZsw9sXvMfOVKCExtlUKY4aX7xzHZl9blAS2+Ogv2EaSqUExhIX/qG6D9aoFpNf8h
 ZROw==
X-Gm-Message-State: AOJu0YzSS4DyWS9taAzOpW6/Dd4fQ1h8fmT7SxZ/7n22LzI+ZZ3VRjN7
 dxbabfboWpa+XEoeZn3SEXwKgnb+ZagUuBYUn+ayYvc83o/j9ZBa
X-Google-Smtp-Source: AGHT+IEzDdyy70Ol5OLZpgb5nEvYSh4k5FOXP06q889cVs7WwbUrjUKUX5S/fkgmtt3fZzQBwrTUPw==
X-Received: by 2002:a05:6512:3d28:b0:52c:9a89:ece9 with SMTP id
 2adb3069b0e04-52ca6ea5d43mr7905295e87.4.1718723259073; 
 Tue, 18 Jun 2024 08:07:39 -0700 (PDT)
Received: from lili ([131.254.253.81]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-422870e9676sm224868145e9.24.2024.06.18.08.07.37
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 18 Jun 2024 08:07:38 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: 71631 <at> debbugs.gnu.org
Subject: Re: [bug#71631] [PATCH] swh: Specify 'extid_version' when looking
 up by external ID.
In-Reply-To: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@HIDDEN>
References: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@HIDDEN>
Date: Tue, 18 Jun 2024 17:07:34 +0200
Message-ID: <87r0cuqog9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71631
Cc: Josselin Poiret <dev@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
 Tobias Geerinckx-Rice <me@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>,
 Christopher Baines <guix@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Re,

> -  (if (string-suffix? "/" url)
> -      url
> -      (string-append url "/")))
> +  (cond
> +   ((string-suffix? "/" url)
> +    url)
> +   ;; Special case; don't redirect
> +   ;; <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>
> +   ((string-contains url "extid_version")
> +    url)
> +   (else
> +    (string-append url "/"))))

For the interested reader, here the message from SWH:

    https://sentry.softwareheritage.org/share/issue/840686e1329b484081ac2b07d27cd4aa/

In short, the redirection is not possible here.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#71631; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Jun 2024 14:05:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 18 10:05:32 2024
Received: from localhost ([127.0.0.1]:43820 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sJZSm-0004S6-3U
	for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 10:05:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:39326)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1sJZSj-0004Ry-UR
 for submit <at> debbugs.gnu.org; Tue, 18 Jun 2024 10:05:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1sJZQX-0004vN-Ge
 for guix-patches@HIDDEN; Tue, 18 Jun 2024 10:03:15 -0400
Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1sJZQV-0003CG-LK
 for guix-patches@HIDDEN; Tue, 18 Jun 2024 10:03:13 -0400
Received: by mail-wr1-x431.google.com with SMTP id
 ffacd0b85a97d-362468852c8so60346f8f.1
 for <guix-patches@HIDDEN>; Tue, 18 Jun 2024 07:03:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1718719390; x=1719324190; darn=gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=W+DMLqCNt5yw0nTz1obirjiRi/MFHAxcX4IeANpodIk=;
 b=gL6v+ZwTMg/f8j1wy00+wIAbeaL/NDJ6vUDy/0bQVFz3/JBwF19flk+X+D8GLzwzuU
 ng0VrGGCQSVHl358cF2b9i9M+dILXz1eO0TSWgtvd0ZC02nT4K8tyavTqzYVU403KzEE
 wRCXvfZrZJNOhXsCMC+d/6xnCt0B6lMjwt/HWHHMcV4asVfLq7Axbpq6SQoQ3FILnl5z
 //iTdAlsHYl06VISjZgPqyeLBuJl5vdTZ9Ly62qaw9DbkmP8Z9OYv2t2cf9mLwYfkBzm
 43XfrSdKxJEVyDX8DDKSQymN74cYVDya9e0RHqUo9Z98zb/huR9UeiDAIgqu92q5UeIL
 gsWA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1718719390; x=1719324190;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=W+DMLqCNt5yw0nTz1obirjiRi/MFHAxcX4IeANpodIk=;
 b=e/BJcKEpiwT09lnYuzvTelAG8bSimoh3BYFVf9rofqCiOaV5M9FrXNU1coMRKjOjly
 1KhJBSCHT2SLTrG3NlgI6bNLEZaKaJplJuIOMINsL72ZLox0rChgKFWCOZ3WmhZCKZ6v
 NmhEQxYOU3AZSi5xqMrzCppiPv07gAFwGJGmlEBZdrYTtGloOHMxZA/9WK96DIOxIbit
 NCuMWXAsDYS4c1UWtqAJKPz/HXjF4ifLGLtDqXEqrP9YaVQWJcQsrp6tW0BS9mfxAqaj
 sAl1IBsLGCCjSlbOvw34hSEy8j3wGbYFsedKWjQaMpr/zlcVxOUobh+QWOYw5+hDlYFT
 jZmQ==
X-Gm-Message-State: AOJu0Yx/uETlgVi+qGyzDrqbpm/zHK/VEhr4O2rkFL6GZGisfbLtQ+AF
 peEB3M8pM1T2BbTGXSDWv/tzfYyXWHtkXqKdyZOUkEwcvNLShliNYUSZhg==
X-Google-Smtp-Source: AGHT+IGsM8CBNwoWdEF1pTHMwLqcH/rrP6WKGVGXcpwufIIMdarJJGwIYMMgjm1JuOaRk9oDUiOmJQ==
X-Received: by 2002:a5d:6c69:0:b0:35f:1f7e:892e with SMTP id
 ffacd0b85a97d-3607a78685amr9385322f8f.7.1718719389427; 
 Tue, 18 Jun 2024 07:03:09 -0700 (PDT)
Received: from lili.rennes.inria.fr ([131.254.253.81])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-360750ad2cdsm14224571f8f.61.2024.06.18.07.03.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 18 Jun 2024 07:03:09 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] swh: Specify 'extid_version' when looking up by external ID.
Date: Tue, 18 Jun 2024 16:02:51 +0200
Message-ID: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
X-Debbugs-CC: ludo@HIDDEN
X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::431;
 envelope-from=zimon.toutoune@HIDDEN; helo=mail-wr1-x431.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Simon Tournier <zimon.toutoune@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Reported in <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>.

* guix/swh.scm (swh-url): Don't redirect when URL contains 'extid_version'.
(lookup-external-id): Specify 'extid_version' avoiding SWH's bug from past
version.

Change-Id: Iea2a5256e0612dae95567907bb11edb92a50df73
---
 guix/swh.scm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Hi,

Without the patch:

    $ guix repl
    scheme@(guix-user)> (use-modules (guix swh) (gnu packages guile-xyz))
    scheme@(guix-user)> (lookup-directory-by-nar-hash
                          (content-hash-value (origin-hash (package-source guile-wisp))) 'sha256)
    $1 = "swh:1:dir:218d95849f10fc0691d7dfa80999ce5061e654ef"

This is incorrect.  As explained in:

    https://gitlab.softwareheritage.org/swh/meta/-/issues/5093

The mismatch comes from something unexpected on SWH side.  That had been
corrected and the way to access to the fix is to update the version; hence the
patch.

    $ ./pre-inst-env guix repl
    scheme@(guix-user)> (use-modules (guix swh) (gnu packages guile-xyz))
    scheme@(guix-user)> (lookup-directory-by-nar-hash
                          (content-hash-value (origin-hash (package-source guile-wisp))) 'sha256)
    $1 = "swh:1:dir:1f35a460673e2c8ccf948b8c18cb8c18d2ec24fe"

WDYT?

Cheers,
simon


diff --git a/guix/swh.scm b/guix/swh.scm
index f602cd89d1..e5824976d4 100644
--- a/guix/swh.scm
+++ b/guix/swh.scm
@@ -166,9 +166,15 @@ (define (swh-url path . rest)
     (string-append root (string-join rest "/" 'prefix)))
 
   ;; Ensure there's a trailing slash or we get a redirect.
-  (if (string-suffix? "/" url)
-      url
-      (string-append url "/")))
+  (cond
+   ((string-suffix? "/" url)
+    url)
+   ;; Special case; don't redirect
+   ;; <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>
+   ((string-contains url "extid_version")
+    url)
+   (else
+    (string-append url "/"))))
 
 ;; XXX: Work around a bug in Guile 3.0.2 where #:verify-certificate? would
 ;; be ignored (<https://bugs.gnu.org/40486>).
@@ -461,7 +467,9 @@ (define (lookup-external-id type id)
 (currently one of: \"bzr-nodeid\", \"hg-nodeid\", \"nar-sha256\",
 \"checksum-sha512\")."
   (call (swh-url "/api/1/extid" type
-                 (string-append "hex:" (bytevector->base16-string id)))
+                 (string-append "hex:" (bytevector->base16-string id)
+                                "/?extid_version=1"
+                                ))
         json->external-id))
 
 (define* (lookup-directory-by-nar-hash hash #:optional (algorithm 'sha256))

base-commit: bc8a41f4a8d9f1f0525d7bc97c67ed3c8aea3111
-- 
2.41.0





Acknowledgement sent to Simon Tournier <zimon.toutoune@HIDDEN>:
New bug report received and forwarded. Copy sent to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, rekado@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN:
bug#71631; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 11 Jul 2024 10:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.