GNU bug report logs - #51726
SWH: ‘lookup-origin-revision’ can miss tags

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; Severity: important; Reported by: Ludovic Courtès <ludovic.courtes@HIDDEN>; dated Tue, 9 Nov 2021 17:12:01 UTC; Maintainer for guix is bug-guix@HIDDEN.
Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 9 Nov 2021 17:11:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 09 12:11:14 2021
Received: from localhost ([127.0.0.1]:35577 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mkUeQ-0006V9-1v
	for submit <at> debbugs.gnu.org; Tue, 09 Nov 2021 12:11:14 -0500
Received: from lists.gnu.org ([209.51.188.17]:55340)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludovic.courtes@HIDDEN>) id 1mkUeK-0006Uw-RN
 for submit <at> debbugs.gnu.org; Tue, 09 Nov 2021 12:11:13 -0500
Received: from eggs.gnu.org ([209.51.188.92]:33320)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludovic.courtes@HIDDEN>)
 id 1mkUeK-0001si-Mz
 for bug-guix@HIDDEN; Tue, 09 Nov 2021 12:11:08 -0500
Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:14664)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludovic.courtes@HIDDEN>)
 id 1mkUeG-0006Q9-5R
 for bug-guix@HIDDEN; Tue, 09 Nov 2021 12:11:08 -0500
IronPort-Data: =?us-ascii?q?A9a23=3AuPbQEa1HqMWfzSPydPbD5fdzkn2cJEfYwER7XOP?=
 =?us-ascii?q?LsXnJ02931zBTyWBOX2uAPf7cZmOgeNlzbI+1/BhSvJSAnN82QQE+nZ1PZyIT+?=
 =?us-ascii?q?JCdXbx1DW+pYnjMdpWbJK5fAnR3huDodKjYdVeB4EfyWlTdhSMkj/jRH+KtULS?=
 =?us-ascii?q?s1h1ZHmeIdg9w0HqPpMZp2uaEsfDha++8kYuaT//3YDdJ6BYoWo4g0J9vnTs01?=
 =?us-ascii?q?BjEVJz0iXRlDRxDlAe2e3D4l/vzL4npR5fzatE88uJX24/+IL+FEmPxp3/BC/u?=
 =?us-ascii?q?/k7zxdUtirrz6bFHI0yQOHfH73V4Y/nVaPqUTbZLwbW9TljmOgdF6jt5KqIasR?=
 =?us-ascii?q?BwBP6vWme1bXQMw/yRWZ/0XoOKdfBBTtuTWlSUqaUDEyehhSU4rPJ0w9eBqR2Z?=
 =?us-ascii?q?U+pQlxJolBvyYr7PvhevlEqw135tmdpGyepgCsGom1SveHf8qB5bOX833CRZj9?=
 =?us-ascii?q?G9Yrqhz8Tz2PKL1sQZSUSk=3D?=
IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A6PQXaKp47q/KH53/v6xw8NgaV5omeYIsimQD?=
 =?us-ascii?q?101hICG9E/bo8PxG+c5w6faaskdzZJhNo7C90cq7IE80l6QFg7X5VI3KNGLbUQ?=
 =?us-ascii?q?CTXeRfBOXZslnd8u7FmtK1F50MT0GzMrLN5JFB4/rH3A=3D=3D?=
X-IronPort-AV: E=Sophos;i="5.87,220,1631570400"; 
   d="scan'208";a="2890525"
Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201])
 by mail2-relais-roc.national.inria.fr with
 ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 18:11:00 +0100
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludovic.courtes@HIDDEN>
To: bug-guix@HIDDEN
Subject: SWH: =?utf-8?Q?=E2=80=98lookup-origin-revision=E2=80=99?= can miss
 tags
X-Debbugs-Cc: zimoun <zimon.toutoune@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 19 Brumaire an 230 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Tue, 09 Nov 2021 18:11:00 +0100
Message-ID: <87mtmdi7a3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=192.134.164.83;
 envelope-from=ludovic.courtes@HIDDEN;
 helo=mail2-relais-roc.national.inria.fr
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
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 (--)

Quoting
<https://lists.gnu.org/archive/html/guix-devel/2021-10/msg00291.html>:

--8<---------------cut here---------------start------------->8---
> However, I get this:
>
> $ guix lint -c archival sway=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20
> gnu/packages/wm.scm:1527:5: sway@HIDDEN: scheduled Software Heritage archi=
val

Indeed, I=E2=80=99m getting that as well.

Right now Sway=E2=80=99s origin refers to the =E2=80=9C1.5.1=E2=80=9D tag.

I found the problem:

scheme@(guile-user)> ,use(guix swh)
scheme@(guile-user)> (lookup-origin-revision "https://github.com/swaywm/swa=
y" "1.5.1")
$2 =3D #f
scheme@(guile-user)> (lookup-origin "https://github.com/swaywm/sway")
$3 =3D #<<origin> visits-url: "https://archive.softwareheritage.org/api/1/o=
rigin/https://github.com/swaywm/sway/visits/" type: #<unspecified> url: "ht=
tps://github.com/swaywm/sway">
scheme@(guile-user)> (car (origin-visits $3))
$4 =3D #<<visit> date: #<date nanosecond: 490956 second: 6 minute: 45 hour:=
 14 day: 29 month: 10 year: 2021 zone-offset: 0> origin: "https://github.co=
m/swaywm/sway" url: "https://archive.softwareheritage.org/api/1/origin/http=
s://github.com/swaywm/sway/visit/41/" snapshot-url: "https://archive.softwa=
reheritage.org/api/1/snapshot/10ba0257e3290ce4504c2413f32b9358d72975d6/" st=
atus: full number: 41>
scheme@(guile-user)> (define s (visit-snapshot $4))
scheme@(guile-user)> ,pp (map branch-name (snapshot-branches s))
*** output flushed ***
scheme@(guile-user)> (length (snapshot-branches s))
$6 =3D 1000
scheme@(guile-user)> (filter (lambda (b)
			       (string-prefix? "refs/tags" (branch-name b)))
			     (snapshot-branches s))
$7 =3D ()
scheme@(guile-user)> ,use(srfi srfi-1)
scheme@(guile-user)> ,pp (take (snapshot-branches s) 10)
$8 =3D (#<<branch> name: "refs/pull/2715/head" target-type: revision target=
-url: "https://archive.softwareheritage.org/api/1/revision/2f258eff6fd2c89a=
94caa658c1ea22beb76d728a/">
 #<<branch> name: "refs/pull/2713/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/4e4898e90f4d9b721091137=
a744deac335e73f12/">
 #<<branch> name: "refs/pull/2712/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/d129108cddc485299443d0b=
98c3bdf3f9839aa1c/">
 #<<branch> name: "refs/pull/271/head" target-type: revision target-url: "h=
ttps://archive.softwareheritage.org/api/1/revision/20cb390323b19dc0c767ba63=
925def7f51c31044/">
 #<<branch> name: "refs/pull/2709/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/426c33f4dc2515867a0d3b0=
4cb865d5cad091d10/">
 #<<branch> name: "refs/pull/2708/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/b1a0e95e8e6ecf66542cc62=
e6109949de59afb5e/">
 #<<branch> name: "refs/pull/2704/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/6194a445d3b10e8afc96871=
2faccdd1d127a8beb/">
 #<<branch> name: "refs/pull/2703/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/f16529e2588f5e71d6777f4=
c06dfb58b29308cd0/">
 #<<branch> name: "refs/pull/2701/head" target-type: revision target-url: "=
https://archive.softwareheritage.org/api/1/revision/baeb28ea6230ef9aa409ee5=
2abe208720120e45c/">
 #<<branch> name: "refs/pull/270/head" target-type: revision target-url: "h=
ttps://archive.softwareheritage.org/api/1/revision/a32cbb52ce81ee38d2928ba8=
73ff7fc182df8393/">)

This snapshot has more than 1,000 branches, mostly =E2=80=98refs/pull=E2=80=
=99 branches.
But by default, the endpoint used by =E2=80=98visit-snapshot=E2=80=99 only =
returns the
first 1,000 branches, and then it=E2=80=99s up to the caller to use the
pagination mechanism.

It=E2=80=99s not implemented though!  It turns out the =E2=80=98refs/tags=
=E2=80=99 =E2=80=9Cbranches=E2=80=9D
were not among the first thousand branches, so the code incorrectly
thinks that the tag is missing.

The solution is to implement pagination (yuk!), or to use an endpoint to
look up a branch by name instead of using =E2=80=98snapshot-branches=E2=80=
=99 (is there
such an endpoint?).
--8<---------------cut here---------------end--------------->8---

Ludo=E2=80=99.




Acknowledgement sent to Ludovic Courtès <ludovic.courtes@HIDDEN>:
New bug report received and forwarded. Copy sent to zimon.toutoune@HIDDEN, bug-guix@HIDDEN. Full text available.
Report forwarded to zimon.toutoune@HIDDEN, bug-guix@HIDDEN:
bug#51726; Package guix. 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, 18 Nov 2021 14:15:02 UTC

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