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

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludovic.courtes <at> inria.fr>

Date: Tue, 9 Nov 2021 17:12:01 UTC

Severity: important

To reply to this bug, email your comments to 51726 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to zimon.toutoune <at> gmail.com, bug-guix <at> gnu.org:
bug#51726; Package guix. (Tue, 09 Nov 2021 17:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludovic.courtes <at> inria.fr>:
New bug report received and forwarded. Copy sent to zimon.toutoune <at> gmail.com, bug-guix <at> gnu.org. (Tue, 09 Nov 2021 17:12:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludovic.courtes <at> inria.fr>
To: bug-guix <at> gnu.org
Subject: SWH: ‘lookup-origin-revision’ can miss
 tags
Date: Tue, 09 Nov 2021 18:11:00 +0100
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                    
> gnu/packages/wm.scm:1527:5: sway <at> 1.5.1: scheduled Software Heritage archival

Indeed, I’m getting that as well.

Right now Sway’s origin refers to the “1.5.1” tag.

I found the problem:

scheme@(guile-user)> ,use(guix swh)
scheme@(guile-user)> (lookup-origin-revision "https://github.com/swaywm/sway" "1.5.1")
$2 = #f
scheme@(guile-user)> (lookup-origin "https://github.com/swaywm/sway")
$3 = #<<origin> visits-url: "https://archive.softwareheritage.org/api/1/origin/https://github.com/swaywm/sway/visits/" type: #<unspecified> url: "https://github.com/swaywm/sway">
scheme@(guile-user)> (car (origin-visits $3))
$4 = #<<visit> date: #<date nanosecond: 490956 second: 6 minute: 45 hour: 14 day: 29 month: 10 year: 2021 zone-offset: 0> origin: "https://github.com/swaywm/sway" url: "https://archive.softwareheritage.org/api/1/origin/https://github.com/swaywm/sway/visit/41/" snapshot-url: "https://archive.softwareheritage.org/api/1/snapshot/10ba0257e3290ce4504c2413f32b9358d72975d6/" status: 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 = 1000
scheme@(guile-user)> (filter (lambda (b)
			       (string-prefix? "refs/tags" (branch-name b)))
			     (snapshot-branches s))
$7 = ()
scheme@(guile-user)> ,use(srfi srfi-1)
scheme@(guile-user)> ,pp (take (snapshot-branches s) 10)
$8 = (#<<branch> name: "refs/pull/2715/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/2f258eff6fd2c89a94caa658c1ea22beb76d728a/">
 #<<branch> name: "refs/pull/2713/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/4e4898e90f4d9b721091137a744deac335e73f12/">
 #<<branch> name: "refs/pull/2712/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/d129108cddc485299443d0b98c3bdf3f9839aa1c/">
 #<<branch> name: "refs/pull/271/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/20cb390323b19dc0c767ba63925def7f51c31044/">
 #<<branch> name: "refs/pull/2709/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/426c33f4dc2515867a0d3b04cb865d5cad091d10/">
 #<<branch> name: "refs/pull/2708/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/b1a0e95e8e6ecf66542cc62e6109949de59afb5e/">
 #<<branch> name: "refs/pull/2704/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/6194a445d3b10e8afc968712faccdd1d127a8beb/">
 #<<branch> name: "refs/pull/2703/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/f16529e2588f5e71d6777f4c06dfb58b29308cd0/">
 #<<branch> name: "refs/pull/2701/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/baeb28ea6230ef9aa409ee52abe208720120e45c/">
 #<<branch> name: "refs/pull/270/head" target-type: revision target-url: "https://archive.softwareheritage.org/api/1/revision/a32cbb52ce81ee38d2928ba873ff7fc182df8393/">)

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

It’s not implemented though!  It turns out the ‘refs/tags’ “branches”
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 ‘snapshot-branches’ (is there
such an endpoint?).
--8<---------------cut here---------------end--------------->8---

Ludo’.




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 18 Nov 2021 14:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#51726; Package guix. (Mon, 12 Feb 2024 11:41:02 GMT) Full text and rfc822 format available.

Message #10 received at 51726 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludovic.courtes <at> inria.fr>
To: 51726 <at> debbugs.gnu.org
Cc: zimoun <zimon.toutoune <at> gmail.com>
Subject: Re: bug#51726: SWH: ‘lookup-origin-revision’ can miss tags
Date: Mon, 12 Feb 2024 12:27:51 +0100
Ludovic Courtès <ludovic.courtes <at> inria.fr> skribis:

> Quoting
> <https://lists.gnu.org/archive/html/guix-devel/2021-10/msg00291.html>:
>
>> However, I get this:
>>
>> $ guix lint -c archival sway                    
>> gnu/packages/wm.scm:1527:5: sway <at> 1.5.1: scheduled Software Heritage archival

For the record, this particular problem is sidestepped by the
introduction of nar-sha256 ExtID lookup in commit
29f3089c841f00144f24f5c32296aebf22d752cc:

  https://issues.guix.gnu.org/68741

It would still be nice to fix but it’s much less critical now.

Ludo’.




This bug report was last modified 1 year and 124 days ago.

Previous Next


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