From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id qJ5ELi4BF2VFqQAA9RJhRA:P1 (envelope-from ) for ; Fri, 29 Sep 2023 18:54:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id qJ5ELi4BF2VFqQAA9RJhRA (envelope-from ) for ; Fri, 29 Sep 2023 18:54:06 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 209DEF3D9 for ; Fri, 29 Sep 2023 18:54:06 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=KQOM5AIw; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b="AgiAvD/d"; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696006446; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=FRLivO+BOvv4ofDyu3g7LStRVPZTRrkjJTaM4f8fu/c=; b=Gvf+h4F18jkteNFufw57sV6XblY8/1R9Gp0v61aNexrDDiNev36UEU44YuC/zuQK2T9BjG omhDRXTZg82hOAEWBXtjzBXT2oov4mX0lWzc3SjxQNr2HhSY5ZliYizl+C/z6Q3mIZhSPP 913e+PZqJKkANkCmSLNQ8I3MD3OCbO5qVBREM+j3+8gY+WrQg1ef2s9TQOGJLwUnTgnAwK /EPp3kta6rdAFyeMg+46baFXC9ILNSmrdVE10U8BI6LOelGwNhXRwtjuvXJxbLnhCAT6vH OddekQkS/xlu7oR8QALTkxrLxlile3p2APPlnXBt8KXQxagHDzpOyiPfLy2oPw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696006446; a=rsa-sha256; cv=none; b=l5Fp26v1ucra4GHimGx5HIupmVOszjIqr3ITWyNZTvcntnDk/YKeBzHxTgARp9x87wXo2y 9NlJ3hJX2hxm8PEfh5X4zU8crwfwi6pICILMis9ZPjGTYDTFUvJgI5M+LUWgaasDmbEd95 rR/q9gcl1kNiiBA/XaqVrbww/nkJ2KlYuh9OQ34V6M0l42Ltfdd1I9saoRl7EpDeNMPemW jSkjRztLu6JVQe/QZz5m3OsuaNK/TFpz4j7XT2PfOcwuFjTFJgFR9NUCKChDC4wL/tQ5Gr 2ytHwE8D1dcDlfc/laiTUMMsngOoARqdYCJXKDcPPZrYTNH+xgb/ULnQ9cbcYg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b=KQOM5AIw; dkim=fail ("headers rsa verify failed") header.d=wolfsden.cz header.s=mail header.b="AgiAvD/d"; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=wolfsden.cz (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qmGkP-0004mJ-UE; Fri, 29 Sep 2023 12:53:50 -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 ) id 1qmGkO-0004m2-HO for bug-guix@gnu.org; Fri, 29 Sep 2023 12:53:48 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qmGkN-0006El-Tw for bug-guix@gnu.org; Fri, 29 Sep 2023 12:53:48 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qmGkc-0007Io-NK for bug-guix@gnu.org; Fri, 29 Sep 2023 12:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#66268: Guix makes invalid assumptions regarding guile-git guarantees leading to guix pull failing Resent-From: wolf Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 29 Sep 2023 16:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66268 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 66268@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169600640527998 (code B ref -1); Fri, 29 Sep 2023 16:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Sep 2023 16:53:25 +0000 Received: from localhost ([127.0.0.1]:57069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qmGk0-0007HV-UW for submit@debbugs.gnu.org; Fri, 29 Sep 2023 12:53:25 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53076) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qmGjx-0007H3-I2 for submit@debbugs.gnu.org; Fri, 29 Sep 2023 12:53:22 -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 ) id 1qmGjW-0004Hc-VR for bug-guix@gnu.org; Fri, 29 Sep 2023 12:52:57 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qmGjS-0005zr-69 for bug-guix@gnu.org; Fri, 29 Sep 2023 12:52:54 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 9E2CF25FF78; Fri, 29 Sep 2023 16:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1696006364; bh=oj5b7mUnaSSEcmecccWHc8TpJO3BG/H+9sF0J8SdrXY=; h=Date:From:To:Subject; b=KQOM5AIw0B1RoyIfKN0EEb8gW4xRu06B2q95muApiXVPo8zSS76/O+WeQb1JDyXbQ 6w4GBo6vr1hOrJIaWaLv9KYW+lhdQ9pxLH9chE1T9mpftHH4I8qlYhIclfj0kDfaQ3 eTgjpKlUose7Bzij2TGwLRi4/SR0hOJp9gsKhCpoHbrZJ350H1ZgqosmY7hUEJqIHM rABntmuNAeU/tHvK3CGEdYkwsNUe8TyEAWnzw3TR52Qqx6d8BffnpAt1ctiUsLDvlC /kK2udLWVFJjzhwwEdqhW4EsTNi2QtIJo4L8tq7RiY0X3kSWCEUbkWuHUFpq8rAl1U BUnsjiNP6UxsMpouO5+5h3Yt92E6tjKSHvi59PwvKzcNWScJ+eezQOM9XUEHUH+Xfg 8SlRSJjqxayImrWyv+FoDyNXrB2uqf8tyYGH0hc35hK/0WxXRGAJvapptiympiz7FZ dhqyFrfD8l5i9OrAsvwpM3BHM/1kM/czFU2GYVm8I0Hng5xy/U9TRrxSB4/OErUYMl 3vOcoNedM9f6wnBchoCav6vp45kZoS4s+zu7E03p0+bXo+hdwxxVhyPLkSp+k5T4F6 xQpe34yqQsYxS7HlBdlz7JuCWDzVc1e/Fw9WX7Ez4CVxkoSisrdaCS+pYoE+GdJ7kh jNripxij7OJHlYfaJyx88Y94= Received: from localhost (unknown [81.17.16.87]) by wolfsden.cz (Postfix) with ESMTPSA id B2B0625FF77 for ; Fri, 29 Sep 2023 16:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1696006363; bh=oj5b7mUnaSSEcmecccWHc8TpJO3BG/H+9sF0J8SdrXY=; h=Date:From:To:Subject; b=AgiAvD/dLnNhjpqRI6h6XCY2F096U5+17Kc4V9havYCnBs9ZkLroRIS8MUx3cheFV DDnCEpxmuRrlA4Rvc66tKWMVqfS0qixqzPkw/R28bSw6b3P5Drc/6Dumra6lLOjK44 CUfaizJiGLryr6xBuuvtmyqeDPzxl9mPwozUEas7ufuC10pv5pfSkUA4ffHXN09i9x 8givr7fVLRC5lNs1M2W9gwr3h2jZWVY72/PtkFvzlbKo7ds7FB8a6gM69asL+V3pP/ rzc2IE4/XH2ztoEPvfVBX4loi1Y+4fp2qLi+1XoxNQs6pM7efldS8kGETGoOB4ovEL 2PLc43FYLU+eZNxIFZAeOqkhHaFnZQHN2eDPJHO1fFyLuzVl2rz+ttutEwOp/cvIIr 7Gp9DZACEPaw8CKIpttWUxfxq/voDs9O2B2Y1nyOwoGrflvfU/FJ750A8rAEBLrpRW aVhVLJPqp++y7XVLQsT45+2L7o/n4X+GGpP68aSKZ0/0RREqzd8jwOIE0XAbzgVmXJ ZPpGQ8EaXDmQsGV9djHYGYfNTGzj1DIe3lTs/QyYx1gS/LuceRlZm4HL1RQGB4PMdU 8zElGYm7teovOIctb5C9RYH2NCToOoixXvy+aK5LiJjmo+XVFLwdqOZDqiQZ+nonQQ FSQazIoPKP38UHzf7ddvdb8g= Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 8b14761c for ; Fri, 29 Sep 2023 16:52:43 +0000 (UTC) Date: Fri, 29 Sep 2023 18:52:43 +0200 From: wolf Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pesXC/INFpw/3QMw" Content-Disposition: inline Received-SPF: none client-ip=37.205.8.62; envelope-from=ws@wolfsnet.cz; helo=wolfsden.cz X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: 3.26 X-Spam-Score: 3.26 X-Migadu-Queue-Id: 209DEF3D9 X-TUID: EBkcgII2UzXb --pesXC/INFpw/3QMw Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Table of Contents _________________ 1. Guix makes an invalid assumption regarding guile-git's guarantees =2E. 1. Root cause analysis =2E.... 1. Object size =2E.... 2. Cache space =2E. 2. Reproduction to verify the analysis 2. Possible solutions =2E. 1. Do not use `eq?' =2E. 2. Increase the cache size / limits =2E. 3. Ensure the id stability in guile-git 3. Questions =2E. 1. Is this a regression? 4. Attachments =2E. 1. d51135e8477118dc63a7e5462355cd27e884f4fb =2E. 2. test.scm 1 Guix makes an invalid assumption regarding guile-git's guarantees =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D There is an assumption made by Guix regarding guile-git, which is not true. The problem is demonstrated using my fork, since that is where I encountered it first, but official Guix will hit the same problem sooner or later. I will also provide an independent repository for the verification. Guix made a design decision to compare commit objects using eq?, based on the assumption that guile-git will return the same object for the same commit. However that assumption is wrong and can lead to fun issues like: ,---- | scheme@(guile-user)> (use-modules (git) (guix git)) | scheme@(guile-user)> (define %repo (repository-open "/tmp/my-fork")) | scheme@(guile-user)> (define %hash "d51135e8477118dc63a7e5462355cd27e88= 4f4fb") | scheme@(guile-user)> (commit-relation | (commit-lookup %repo (string->oid %hash)) | (commit-lookup %repo (string->oid %hash))) | $5 =3D unrelated `---- This does break (at least) `guix pull': ,---- | Updating channel 'guix' from Git repository at 'https://git.sr.ht/~gray= wolf/guix'... | guix pull: error: aborting update of channel 'guix' to commit 4dbd25fa0= e09b40ba2ab01d1e64fa36db652b501, which is not a descendant of d51135e847711= 8dc63a7e5462355cd27e884f4fb | hint: This could indicate that the channel has been tampered with and i= s trying to force a roll-back, preventing you from getting the latest updat= es. If you think this is not the case, | explicitly allow non-forward updates. `---- The commit actually is a descendant, but it is not found in the `commit-closure' due to the `eq?' comparison being used. The verification of the relation between the commits: ,---- | $ git log --first-parent --oneline -4 | 4dbd25fa0e (HEAD -> master, origin/master) etc/fork-guix: Use absolute = path for the patch file. | 601029b97a Merge updates from the Guix proper | afa5eabc93 git-authenticate: Fix tracking of trusted parents. | d51135e847 Merge updates from the Guix proper `---- 1.1 Root cause analysis ~~~~~~~~~~~~~~~~~~~~~~~ Guile-git is a wrapper around libgit2, and libgit2 (as far as I can tell) makes no guarantees about returning the same commit object every time lookup is performed for the same hash. It just does it, sometimes, due to the internal use of a cache. There are two rules in place. 1.1.1 Object size ----------------- Object has to be smaller than configured size limit for the object type. For commits, that is 4096B. It can be increased (`git_libgit2_opts' called with `GIT_OPT_SET_CACHE_OBJECT_LIMIT'), but guile-git does not offer any binding for that functionality. In the case illustrated above, the commit object for 4.1 has size of 4139B, and is therefore never cached. That means that a new object is returned every time, and therefore they are never considered equal by Guix. As you can see, the commit message, while long, is sensible and useful, so it is fairly easy to hit the limit. 1.1.2 Cache space ----------------- Cache is limited to 268435456B, and it is pruned if the need to get more space arises. That is especially problematic because it could lead to hard to debug failures based on the access pattern to the repository. Typical signed commit seems to be larger than 1kB. Based on the cache size, rough calculation suggests that Guix (which requires the commits to be signed) can only store somewhere around 252052 commits before running into possible issues. Currently there are 64416 commits since the channel introduction, so we are already getting close and it *will* be a problem in the future, even if we keep the commits smallish. 1.2 Reproduction to verify the analysis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To verify that the analysis above is correct, I created a test repository to run tests against. `head' refers to a commit at the HEAD, it is a small one (210B libgit2's entry size). `large' refers to a commit with a large (4kB) commit message, it is the parent of `head'. `root' refers to the root commit. All other commits are of 210B entry size. The repository is located here[0]. When the 4.2 is executed, it seems to support the conclusions reached in previous section. The output when executed on my machine is: ,---- | Checking (eq? (%commit X) (find-c (%hash X))) for X: |=20 | ;;; (large #f) |=20 | ;;; (head #t) |=20 | ;;; (root #t) | Collecting all commits... | Checking if they match themselves... | # of mismatches 300530 of 1578267 commits | Relation between 'head and 'large: unrelated `---- We can see that both `head' and `root' do match themselves, since they are small and fit into the cache. However `large' does not fit into the cache, and therefore we get new, distinct, object from each `commit-lookup' call. That seems to confirm the hypothesis regarding the limit on object size that fits into the cache. After that we record all commits into a vhash, overwhelming the cache and forcing evictions. After that we do a second sweep to check how many of the commit will match itself. We can see that about 20% of commits do not match, confirming the hypothesis regarding the cache capacity. And finally we see that `head' and `large' are unrelated, despite that not being the case, after all, `head' is the parent of `large'. Git tooling does confirm that: ,---- | $ git merge-base --is-ancestor 9b985229bcd 71f544c102a; echo $? | 0 `---- 0: 2 Possible solutions =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 2.1 Do not use `eq?' ~~~~~~~~~~~~~~~~~~~~ The correct solution is to stop using `eq?' to compare the commits (and other objects from guile-git, if that is being done). That will come at some performance cost, but the benefit of being actually correct does out-weight that. My partial solution is based on new record type, `', to use instead of (guix sets). ,---- | (define-record-type | (%make-commit-set vhash) | commit-set? | (vhash commit-set-vhash)) |=20 | (define (make-commit-set) | (%make-commit-set vlist-null)) |=20 | (define (commit-set-contains? commit commit-set) | (->bool (vhash-assoc (oid->string (commit-id commit)) | (commit-set-vhash commit-set)))) |=20 | (define (commit-set-insert commit commit-set) | (%make-commit-set (vhash-cons (oid->string (commit-id commit)) | #t | (commit-set-vhash commit-set)))) `---- It is not complete, for example I do not check that the commits do come from the same repository. However I believe similar approach is the preferred solution. 2.2 Increase the cache size / limits ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ While the size limit for objects to be cache-able is configurable, the maximum size of the cache is hard coded. However patching libgit2 is always an option. But this does not really solve the issue, it just pushes it down the line. Removing the size limits is also an option, but would lead to unbound memory usage. 2.3 Ensure the id stability in guile-git ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Technically it should be possible to improve guile-git to ensure the object stability without patching the libgit2, but it would basically involve a second cache, without size limits. It could probably utilize weak hash tables to make the memory usage reasonable. However it would be tricky to make sure everything is correctly wrapped. 3 Questions =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 3.1 Is this a regression? ~~~~~~~~~~~~~~~~~~~~~~~~~ Since this was the approach chosen by Guix, did guile-git or libgit2 used to guarantee this? Should this be reported as a regression? 4 Attachments =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 4.1 d51135e8477118dc63a7e5462355cd27e884f4fb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ,---- | commit d51135e8477118dc63a7e5462355cd27e884f4fb | Merge: 75daa689f1 0500af5556 | Author: Tomas Volf | Date: Wed Sep 27 21:03:40 2023 +0200 |=20 | Merge updates from the Guix proper | =20 | * upstream/master: | Revert "build: Add missing guix-gc.timer file to binary tarball." | gnu: tio: Update to 2.7. | gnu: bcachefs-tools: Restore mount.bcachefs shell script version. | gnu: bcachefs-tools: Remove obsolete phase. | gnu: bcachefs-tools: Update to 1.2-0.1e35840. | Revert "gnu: bcachefs-tools: Restyle format." | gnu: sssd: Update to 2.9.2. | gnu: wvkbd: Update to 0.14.1. | gnu: yt-dlp: Update to 2023.09.24. | gnu: lhasa: Update to 0.4.0. | gnu: vcmi: Update to 1.3.2. | gnu: cmark: Update to 0.30.3. | gnu: python-tslearn: Update to 0.6.2. | gnu: python-astropy: Update to 5.3.3. | gnu: python-stdatamodels: Update to 1.8.0. | gnu: python-roman-datamodels: Remove all test constraints. | gnu: python-roman-datamodels: Update to 0.17.1. | gnu: python-rad: Update to 0.17.1. | gnu: python-pyvo: Update to 1.4.2. | gnu: python-photutils: Update to 1.9.0. | gnu: python-jwst: Update to 1.11.4. | gnu: python-fitsio: Update to 1.2.0. | gnu: python-crds: Update to 11.17.4. | gnu: python-bayesicfitting: Update to 3.2.0. | gnu: python-sunpy: Enable more tests. | gnu: python-cdflib: Fix version detection. | gnu: python-cdflib: Update to 1.1.0. | gnu: python-astropy-healpix: Update to 1.0.0. | gnu: splash: Update to 3.8.4. | gnu: libxisf: Extend description. | gnu: libxisf: Update to 0.2.9. | gnu: python-coloful: Update to 0.5.5. | gnu: python-pyotp: Update to 2.9.0. | gnu: gajim: Clean up formatting. | gnu: python-nbxmpp: Clean up formatting. | gnu: gajim-openpgp: Update to 1.5.0. | gnu: gajim-omemo: Update to 2.9.0. | gnu: gajim: Update to 1.7.3. | gnu: python-nbxmpp: Update to 4.2.2. | gnu: transmission: Fix loading icons in pure environments. | gnu: alex4: Remove non-free package. | doc: Update bug-reference configuration snippet. | tests: Assume =E2=80=98git=E2=80=99 is always available. | git-download: Use =E2=80=9Cbuiltin:git-download=E2=80=9D when ava= ilable. | perform-download: Use the =E2=80=98git=E2=80=99 command captured = at configure time. | build: Add dependency on Git. | daemon: Add =E2=80=9Cgit-download=E2=80=9D built-in builder. | perform-download: Remove unused one-argument clause. | git-download: Honor the =E2=80=98GUIX_DOWNLOAD_FALLBACK_TEST=E2= =80=99 environment variable. | git-download: Move fallback code to (guix build git). | tests: Adjust =E2=80=98guix graph --path=E2=80=99 test to latest = Emacs changes. | gnu: imgui: Update to 1.89.9. | gnu: Add tracy. | gnu: Add tracy-wayland. | gnu: glfw: Patch dlopen calls. | gnu: imgui: Enable freetype support. | gnu: capstone: Update to 5.0.1. | gnu: gtypist: Install the gtypist-mode Emacs major mode. | multiqc: Don't propagate inputs. | gnu: transmission: Restore HTML files in the default output. | gnu: aalib: Really build the shared library on powerpc64le-linux. | gnu: edk2-tools: Update to 202308. | doc: Add new 'Circular Module Dependencies' section. | gnu: embedded: Turn packages using top-level variables into proce= dures. | gnu: avr: Delay all cross compilation packages. | gnu: Add satdump. | gnu: nng: Update to 1.5.2. | gnu: sdrangel: Update to 7.16.0. `---- 4.2 test.scm ~~~~~~~~~~~~ ,---- | (use-modules (ice-9 vlist) | (git) | (guix git)) |=20 | ;;; Tweak the path as necessary. | (define %repo (repository-open "/home/wolf/tmp/guix-guile-git-repro")) |=20 | ;;; All hashes that are of interest to us. | (define %hashes '((large . "9b985229bcd447261b147c6bf70a86c2a345f234") | (head . "71f544c102a658ed5f2f2258862f2d59cbe70b8b") | (root . "db3f74122f4c384897ba7fddac73b893d19c1c67"))) | (define (%hash for) | "Return a sha1 hash for a specified key." | (assoc-ref %hashes for)) |=20 | (define %Xs | (map car %hashes)) |=20 | (define (find-c hash) | "Return a commit based on the string sha1 hash." | (commit-lookup %repo (string->oid hash))) |=20 | ;;; Memoize the commits so that we can compare against them later. | (define %commits (map (=CE=BB (k) `(,k . ,(find-c (%hash k)))) | %Xs)) | (define (%commit for) | "Return a memoized commit for a specified key." | (assoc-ref %commits for)) |=20 | (display "Checking (eq? (%commit X) (find-c (%hash X))) for X:\n") | (for-each (=CE=BB (x) | (pk x (eq? (%commit x) (find-c (%hash x))))) | %Xs) |=20 | (display "Collecting all commits...\n") | (define all-commits | (let loop ((commits vlist-null) | (hash (%hash 'head))) | (let* ((c (find-c hash)) | (parents (commit-parents c)) | (commits (vhash-cons (oid->string (commit-id c)) | c | commits))) | (if (null? parents) | commits | (loop commits | (oid->string (commit-id (car parents)))))))) | (display "Checking if they match themselves...\n") | (format #t "# of mismatches ~a of ~a commits\n" | (vlist-fold (=CE=BB (x total) | (let ((hash (car x)) | (commit (cdr x))) | (if (eq? commit (find-c hash)) | total | (+ total 1)))) | 0 | all-commits) | (vlist-length all-commits)) |=20 | (format #t "Relation between 'head and 'large: ~a\n" | (commit-relation (%commit 'head) | (%commit 'large))) `---- Have a nice day, W. --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --pesXC/INFpw/3QMw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmUXANUACgkQL7/ufbZ/ wakODA/8DxkKlgO32+U9sJxD0ZS8QN7Hua1SzsUmVChlPasuFqHgqx0Exu9y8qSv I7N72W0zam6LEjWtGhzfF8kTamtrNALObqPi6Xw21VrXm4iO2LFQy9tZaGAxQvtb +I8CCVtAxS/Gk8ehCYGXpGpeafE0/TBzB/b+0Mjqx+KdAq7amWTzLGo8/5O1Qe8l Zrr+VW2KdYCDRi6qMR5DsxCQin38m8yuYiD/mX7vjTF6w/XHf73U9QqzTNwYwYLi vgEscW+5VbseEE3ESyyei9S0H2cORfRT2UIFZGwsg6IZE1nHCD+lQjfPdGl8pIo8 3iFWgffkOYdp6zqo1VLPNcEGIDwvN5JdPRE3O+skqzCUhfoT9a3wymDgd/92HDKp YvxNiGLQfXmXIq3UsCbBIAvSy6wec+rn8twxRDFf8fNlB1Ma8UPUXwV0h3TSFet5 xWlMeTyki/uWcLDSBSaVt5SyRvKw3DZ9XO+G6L91G5KqdWvjn/Ll03OuHezM8K7I SIhcZylwdEhBCRdZr6JVN/uu005nkhKQ1omgi8hjsZaHGZFVg9o9+r22n5cFPOol 6ocs4DDXf81fMuhY48FB4+/9Ha62xsO/m/tEhFsNEqrCIPe9ciAPjoa5ElPsYaiI iJEwqduWUGCQ9TXWS1ZyKhIZkG9iO2DU7e+4GGP9BwSjzEQp0iU= =yCeP -----END PGP SIGNATURE----- --pesXC/INFpw/3QMw--