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> Full text available.

Message received at submit <at>

Received: (at submit) by; 9 Nov 2021 17:11:14 +0000
From debbugs-submit-bounces <at> Tue Nov 09 12:11:14 2021
Received: from localhost ([]:35577
	by with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at>>)
	id 1mkUeQ-0006V9-1v
	for submit <at>; Tue, 09 Nov 2021 12:11:14 -0500
Received: from ([]:55340)
 by with esmtp (Exim 4.84_2)
 (envelope-from <ludovic.courtes@HIDDEN>) id 1mkUeK-0006Uw-RN
 for submit <at>; Tue, 09 Nov 2021 12:11:13 -0500
Received: from ([]:33320)
 by 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 ([]:14664)
 by 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?=
IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A6PQXaKp47q/KH53/v6xw8NgaV5omeYIsimQD?=
X-IronPort-AV: E=Sophos;i="5.87,220,1631570400"; 
Received: from (HELO ribbon) ([])
 by 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
X-Debbugs-Cc: zimoun <zimon.toutoune@HIDDEN>
X-Revolutionary-Date: 19 Brumaire an 230 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
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=;
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,
 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>
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <>
List-Unsubscribe: <>, 
 <mailto:debbugs-submit-request <at>>
List-Archive: <>
List-Post: <mailto:debbugs-submit <at>>
List-Help: <mailto:debbugs-submit-request <at>>
List-Subscribe: <>, 
 <mailto:debbugs-submit-request <at>>
Errors-To: debbugs-submit-bounces <at>
Sender: "Debbugs-submit" <debbugs-submit-bounces <at>>
X-Spam-Score: -2.3 (--)


--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=
> gnu/packages/wm.scm:1527:5: sway@HIDDEN: scheduled Software Heritage archi=

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 "
y" "1.5.1")
$2 =3D #f
scheme@(guile-user)> (lookup-origin "")
$3 =3D #<<origin> visits-url: "
rigin/" type: #<unspecified> url: "ht=
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: "
m/swaywm/sway" url: "
s://" snapshot-url: "https://archive.softwa=" 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: "
 #<<branch> name: "refs/pull/2713/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/2712/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/271/head" target-type: revision target-url: "h=
 #<<branch> name: "refs/pull/2709/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/2708/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/2704/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/2703/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/2701/head" target-type: revision target-url: "=
 #<<branch> name: "refs/pull/270/head" target-type: revision target-url: "h=

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---


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.