Received: (at 77875) by debbugs.gnu.org; 21 Apr 2025 11:19:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 21 07:19:57 2025 Received: from localhost ([127.0.0.1]:60954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u6pBo-0000lu-Lm for submit <at> debbugs.gnu.org; Mon, 21 Apr 2025 07:19:57 -0400 Received: from wolfsden.cz ([37.205.8.62]:44788) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1u6pBk-0000le-Us for 77875 <at> debbugs.gnu.org; Mon, 21 Apr 2025 07:19:50 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id CB58139D8BF; Mon, 21 Apr 2025 11:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1745234387; bh=L5oJUp8AkP22Thn95k3p6l4vlTVzAUbd96rzs/qRdW0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=CqdIjBdKmDZBneHBpKFB7GOz6k3IZNct9FfgcPYAGNZAge/JMYOFeTvIBpGZ3XE3D rmsQ1lFofDJoQZ6i3oz23OddDnaHnejCSC06Ie1ZXlCNbK3TD8fRtwcgniZaQhds/2 t58qRrGv29Q51XZVsF6EWQ+woGvuCi2qJJ2E6lnqkP96PZRHCMynUE3xtdRZanzpxD Cso28ls0GRbJ6ASrISFEV6nK6S88vvGrLvBZ7J5eigm1bgI47q+RRALe3VzFPnutUQ VQgta5MOlyhFncT7GsB9Z5ey5qRhJQA9ynMPyqAxNYCbyXberqjQRljRJzvCNoheLN YqLfE2L2bJsewYoV97lm3G1czbkENObpfZG5Kwrg3IMt/P2gclQMsogIcXNgCHpnGE PJYQdMVtePN6EEiv8dYXXZT3HJQUEX59c5Ms6KMcD+iZMxMEFPJze9Kye0VjjXR186 XPrhe269W+Ye/KFuCJXgu5xurN6whIzgNF2YuzkWwkgWvKvtkGdeUVOm84gigm5XWA i2+bDxV4YaPw2MH/m32J0JutOXAFyy0sYbRxJP/r3pQtNjv+vWtVm4y/SZZuMXiG5c dkeaUwjsQ9RUdUkwCojTiWEm4HiuvRlk7Q+9J2omuePo/XQ2bDotWwo2tIL6oybSRn nR0qJjwMgxPYdZSAqwPbWjHg= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from localhost (unknown [185.24.21.241]) by wolfsden.cz (Postfix) with ESMTPSA id 3CA1939C7FD; Mon, 21 Apr 2025 11:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1745234386; bh=L5oJUp8AkP22Thn95k3p6l4vlTVzAUbd96rzs/qRdW0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=LjMxLYMUqXVYbimqOMQu+ilqP5N6zkf3nWdBhRr/pctqlxgMy0pJUhH23WiLK7rHo jy/ZujZSCxa/zb4jT0KBmUU81b9f7P03KOw1fL8EBZ3YolPnevKOb3mnnENzy99FTp yTezvIdjvHmaAW2k7hEdZ3uuMzWDgOo/O+dN3Jnz0+a8x3IYWZNDiHQ2meSO8KkrN1 gC5M2T3VOvKrO5lkJQ7LWoypjXMQTTdnRDmsTqKWqlxHZLxam378s2tGXailCfTU4n Yo5iE++Uw53K+56fmssSJzSHFM6NU1AJQGuj8WvkLxs7cCuKiJErjipRjjg0+Z64Xq Q4CMPDCO0jO7kaSZyOEFHEh4H8ojJvPNe6ARIpDgPTR4uA7GNZQkGcvuYr/2P0YOo7 cj/B/K4eSK7wdkZRzENjxNDaLfP15U1s006Po9hxHCXW2CBvZTweEUEsCFJ1TjZGgX jChGk/6UgcWhiF6xcVc/1/SMLd+LBfaH4VrfK+MGppT+m3nvZZJAsaVSdJ+Lc06WMP vCAllgq/5SOgidNM7qYgPbJZRyiL/pQqIHGgcxpVZd97Pd1FwaZY8rXfVFtVBQU2jg uKBQjlJ2vkyJ9EiyZX68bMcN0+NZa11UHoSon2jnjlnj9IwepTLb27IwlnXRHBHuGR oAzDx6Ho2ZM8YNKYCZt1RhI8= From: Tomas Volf <~@wolfsden.cz> To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN> Subject: Re: [PATCH 1/2] git: Use =?utf-8?Q?=E2=80=98graph-descendant=3F?= =?utf-8?Q?=E2=80=99?= from Guile-Git >= 0.10.0 when available. In-Reply-To: <c0bcaeb83bb4ff257f98dc00b8a2669032fdafae.1744920951.git.ludo@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Thu, 17 Apr 2025 22:22:36 +0200") References: <cover.1744920951.git.ludo@HIDDEN> <c0bcaeb83bb4ff257f98dc00b8a2669032fdafae.1744920951.git.ludo@HIDDEN> Date: Mon, 21 Apr 2025 13:19:45 +0200 Message-ID: <87fri192y6.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: 0.0 (/) X-Debbugs-Envelope-To: 77875 Cc: 77875 <at> debbugs.gnu.org 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 (-) Hi, few comments below. Ludovic Court=C3=A8s <ludo@HIDDEN> writes: > Fixes <https://issues.guix.gnu.org/66268>. > > Fixes a bug whereby =E2=80=98commit-relation=E2=80=99 and =E2=80=98commit= -descendant?=E2=80=99 would > provide an incorrect result when two distinct <commit> objects would > exist for the same commit, which can happen when the commit=E2=80=99s met= adata > is beyond 4 KiB, as of libgit2 1.8/1.9. Ooh, so this *used to work* in <1.8, interesting, I had no idea. :) > > This, in turn, would lead =E2=80=98guix pull=E2=80=99 & co. to wrongfully= report an > attempt to downgrade and pull to an unrelated commit. > > * guix/git.scm (commit-relation): When (guix graph) is available, > rewrite in terms of =E2=80=98graph-descendant?=E2=80=99. > (commit-descendant?): Likewise. > > Change-Id: Ie52b188a8dfa90c95a73387c3ab2fdd04d2bf3e9 > Reported-by: Tomas Volf <~@wolfsden.cz> > --- > guix/git.scm | 83 ++++++++++++++++++++++++++++++++-------------------- > 1 file changed, 52 insertions(+), 31 deletions(-) > > diff --git a/guix/git.scm b/guix/git.scm > index 01e0918588..cb26714d2d 100644 > --- a/guix/git.scm > +++ b/guix/git.scm > @@ -732,7 +732,7 @@ (define (print-git-error port key args default-printe= r) > ;;; Commit difference. > ;;; >=20=20 > -(define* (commit-closure commit #:optional (visited (setq))) > +(define* (commit-closure commit #:optional (visited (setq))) ;to remove > "Return the closure of COMMIT as a set. Skip commits contained in VIS= ITED, > a set, and adjoin VISITED to the result." > (let loop ((commits (list commit)) > @@ -768,39 +768,60 @@ (define* (commit-difference new old #:optional (exc= luded '())) > (cons head result) > (set-insert head visited))))))) >=20=20 > -(define (commit-relation old new) > - "Return a symbol denoting the relation between OLD and NEW, two commit > +(define commit-relation > + (if (resolve-module '(guix graph) #:ensure #f) ;Guile-Git >=3D 0.10.0 Two notes here: 1. Should this not be '(git graph)? 2. I thought that when you do `guix pull`, the new Guix is built against the packages in the newly pulled version. So everyone who pulls these changes, should also pull the guile-git 0.10.0 no? It should not be possible to end up in "new guix, old guile-git" situation. So I do not understand why you need both branches. > + (lambda (old new) > + "Return a symbol denoting the relation between OLD and NEW, two = commit > objects: 'ancestor (meaning that OLD is an ancestor of NEW), 'descendant= , or > 'unrelated, or 'self (OLD and NEW are the same commit)." > - (if (eq? old new) > - 'self > - (let ((newest (commit-closure new))) > - (if (set-contains? newest old) > - 'ancestor > - (let* ((seen (list->setq (commit-parents new))) > - (oldest (commit-closure old seen))) > - (if (set-contains? oldest new) > - 'descendant > - 'unrelated)))))) > + (let ((repository (commit-owner old)) > + (old (commit-id old)) > + (new (commit-id new))) > + (cond ((graph-descendant? repository new old) How is the `graph-descendant?' set? The `resolve-module' seems to check for availability of the module, but it does not import bindings from it. (At least that is what short experimentation in REPL suggests...) > + 'ancestor) > + ((oid=3D? old new) > + 'self) > + ((graph-descendant? repository old new) > + 'descendant) > + (else 'unrelated)))) > + (lambda (old new) ;remove when Guile-Git 0.10.0 is wide= spread > + (if (eq? old new) > + 'self > + (let ((newest (commit-closure new))) > + (if (set-contains? newest old) > + 'ancestor > + (let* ((seen (list->setq (commit-parents new))) > + (oldest (commit-closure old seen))) > + (if (set-contains? oldest new) > + 'descendant > + 'unrelated)))))))) >=20=20 > -(define (commit-descendant? new old) > - "Return true if NEW is the descendant of one of OLD, a list of commits. > - > -When the expected result is likely #t, this is faster than using > -'commit-relation' since fewer commits need to be traversed." > - (let ((old (list->setq old))) > - (let loop ((commits (list new)) > - (visited (setq))) > - (match commits > - (() > - #f) > - (_ > - ;; Perform a breadth-first search as this is likely going to > - ;; terminate more quickly than a depth-first search. > - (let ((commits (remove (cut set-contains? visited <>) commits))) > - (or (any (cut set-contains? old <>) commits) > - (loop (append-map commit-parents commits) > - (fold set-insert visited commits))))))))) > +(define commit-descendant? > + (if (resolve-module '(guix graph) #:ensure #f) ;Guile-Git >=3D 0.10.0 Same question regarding '(git graph) here. > + (lambda (new old) > + "Return true if NEW is the descendant of one of OLD, a list of > +commits." > + (let ((repository (commit-owner new)) > + (new (commit-id new))) > + (any (lambda (old) > + (let ((old (commit-id old))) > + (or (graph-descendant? repository new old) > + (oid=3D? old new)))) > + old))) I would be tempted to write this in terms of commit-relation and memq with '(self descendant). Beside being slightly easier to grasp (for me), it would allow you to have just a single branch, since commit-relation is available regardless of guile-git version. Not sure if there would be performance impact in <0.10.0 though. > + (lambda (new old) ;remove when Guile-Git 0.10.0 is wide= spread > + (let ((old (list->setq old))) > + (let loop ((commits (list new)) > + (visited (setq))) > + (match commits > + (() > + #f) > + (_ > + ;; Perform a breadth-first search as this is likely going= to > + ;; terminate more quickly than a depth-first search. > + (let ((commits (remove (cut set-contains? visited <>) com= mits))) > + (or (any (cut set-contains? old <>) commits) > + (loop (append-map commit-parents commits) > + (fold set-insert visited commits))))))))))) >=20=20 > > ;; Have a nice day, Tomas --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
guix-patches@HIDDEN
:bug#77875
; Package guix-patches
.
Full text available.Received: (at 77875) by debbugs.gnu.org; 17 Apr 2025 20:23:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 17 16:23:20 2025 Received: from localhost ([127.0.0.1]:48585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u5VlX-0006mH-89 for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:23:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44654) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1u5Vl9-0006gt-DI for 77875 <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:22:57 -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 1u5Vl3-0001An-Uj; Thu, 17 Apr 2025 16:22:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=1dgNqeEFwGOQbVUuE9XtUV+y0sZdu6MBJiYCFTcvwmE=; b=b/QC2mcTZzZM96wwyEnX 9k/akof+IbNfq1KBqGWLmxlj76oARRzU8Jx0RInQUKSr+6iqMKsp/44JbRna0TvVhKu4jCFjFcxjq VQr8AFdhEzkii7+G19mxk9V1N8CQZmiTb0VYrxt/UUMyhZeUgLK3Y5ZksmSBiuR5d70KKjvXy71+O +ADXjNAYq5iplElvCvZEhxguXfcfHjAdiAxOj0ToWhOZW1IoAfYetCXKwzxwMV980VA83Zbnm+J+3 AlK6ForvnOyPqHQr1cHGMgutMu7Z3qpOoqn5PJRfMiG53GyAPac9f2gMPLHhN9QY8F6DTmPuV+3kN x4PFf+S+fdZ+Gw==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN> To: 77875 <at> debbugs.gnu.org Subject: [PATCH 2/2] git: Remove compatibility shim for Guile-Git <= 0.5.2. Date: Thu, 17 Apr 2025 22:22:37 +0200 Message-ID: <f06e3a3612063553381a994ce329f7044e24240e.1744920951.git.ludo@HIDDEN> X-Mailer: git-send-email 2.49.0 In-Reply-To: <cover.1744920951.git.ludo@HIDDEN> References: <cover.1744920951.git.ludo@HIDDEN> MIME-Version: 1.0 X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77875 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@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 (---) Guile-Git 0.5.2 was released in July 2021. * guix/git.scm (GITERR_HTTP): Remove. Change-Id: I05b2ee36f786bd83ca91c8989912f83f6dde59c0 --- guix/git.scm | 7 ------- 1 file changed, 7 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index cb26714d2d..2ff2bfd8ed 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -206,13 +206,6 @@ (define* (make-default-fetch-options #:key (verify-certificate? #t)) warn-for-invalid-certificate))) options)) -(define GITERR_HTTP - ;; Guile-Git <= 0.5.2 lacks this constant. - (let ((errors (resolve-interface '(git errors)))) - (if (module-defined? errors 'GITERR_HTTP) - (module-ref errors 'GITERR_HTTP) - 34))) - (define (set-git-timeouts connection-timeout read-timeout) "Instruct Guile-Git to honor the given CONNECTION-TIMEOUT and READ-TIMEOUT when talking to remote Git servers. -- 2.49.0
guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
:bug#77875
; Package guix-patches
.
Full text available.Received: (at 77875) by debbugs.gnu.org; 17 Apr 2025 20:23:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 17 16:23:19 2025 Received: from localhost ([127.0.0.1]:48583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u5VlU-0006m0-MQ for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:23:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52368) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1u5Vl6-0006gM-7l for 77875 <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:22:54 -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 1u5Vkz-00019v-Ug; Thu, 17 Apr 2025 16:22:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Ek0b6MjAtxP2i7+AFFBK7M+srxS3Ru7MceiyMIc9GPM=; b=Yr/wT4OQ/2j+grB4K4Lf H9QUJ8/o9QalRbKCFPYNwYZtQq0myc9lCi3d2Gt+YC8D0y7bbv0KOoNCkEk2/baY0V5oavTvBr4Gr xQdJbmUSrZcChRASPe37A0AXduYQMq5HPrBNEC+EQ0SpkybpncMc/FNP0NjDM4Cky9mwb0Ovhe003 6s9/2QLFyyu6p+lK5q7HHxqzaBMpwuuUPcwek4Kj5cB1fqRYZrz8Ji4Zi5Jj8FwYkRMzEwp0DGmSe LmAVRo7Gcy5aHD7lnwjloKtbNg2SeMwEVZYtF9prsSQJ1W5dTFSXzNPqf0USzUIyD5rm1T5nxJuv+ MQl15mCJWnW0KA==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN> To: 77875 <at> debbugs.gnu.org Subject: [PATCH 1/2] =?UTF-8?q?git:=20Use=20=E2=80=98graph-descendant=3F?= =?UTF-8?q?=E2=80=99=20from=20Guile-Git=20>=3D=200.10.0=20when=20available?= =?UTF-8?q?.?= Date: Thu, 17 Apr 2025 22:22:36 +0200 Message-ID: <c0bcaeb83bb4ff257f98dc00b8a2669032fdafae.1744920951.git.ludo@HIDDEN> X-Mailer: git-send-email 2.49.0 In-Reply-To: <cover.1744920951.git.ludo@HIDDEN> References: <cover.1744920951.git.ludo@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77875 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN>, Tomas Volf <~@wolfsden.cz> 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 (---) Fixes <https://issues.guix.gnu.org/66268>. Fixes a bug whereby ‘commit-relation’ and ‘commit-descendant?’ would provide an incorrect result when two distinct <commit> objects would exist for the same commit, which can happen when the commit’s metadata is beyond 4 KiB, as of libgit2 1.8/1.9. This, in turn, would lead ‘guix pull’ & co. to wrongfully report an attempt to downgrade and pull to an unrelated commit. * guix/git.scm (commit-relation): When (guix graph) is available, rewrite in terms of ‘graph-descendant?’. (commit-descendant?): Likewise. Change-Id: Ie52b188a8dfa90c95a73387c3ab2fdd04d2bf3e9 Reported-by: Tomas Volf <~@wolfsden.cz> --- guix/git.scm | 83 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index 01e0918588..cb26714d2d 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -732,7 +732,7 @@ (define (print-git-error port key args default-printer) ;;; Commit difference. ;;; -(define* (commit-closure commit #:optional (visited (setq))) +(define* (commit-closure commit #:optional (visited (setq))) ;to remove "Return the closure of COMMIT as a set. Skip commits contained in VISITED, a set, and adjoin VISITED to the result." (let loop ((commits (list commit)) @@ -768,39 +768,60 @@ (define* (commit-difference new old #:optional (excluded '())) (cons head result) (set-insert head visited))))))) -(define (commit-relation old new) - "Return a symbol denoting the relation between OLD and NEW, two commit +(define commit-relation + (if (resolve-module '(guix graph) #:ensure #f) ;Guile-Git >= 0.10.0 + (lambda (old new) + "Return a symbol denoting the relation between OLD and NEW, two commit objects: 'ancestor (meaning that OLD is an ancestor of NEW), 'descendant, or 'unrelated, or 'self (OLD and NEW are the same commit)." - (if (eq? old new) - 'self - (let ((newest (commit-closure new))) - (if (set-contains? newest old) - 'ancestor - (let* ((seen (list->setq (commit-parents new))) - (oldest (commit-closure old seen))) - (if (set-contains? oldest new) - 'descendant - 'unrelated)))))) + (let ((repository (commit-owner old)) + (old (commit-id old)) + (new (commit-id new))) + (cond ((graph-descendant? repository new old) + 'ancestor) + ((oid=? old new) + 'self) + ((graph-descendant? repository old new) + 'descendant) + (else 'unrelated)))) + (lambda (old new) ;remove when Guile-Git 0.10.0 is widespread + (if (eq? old new) + 'self + (let ((newest (commit-closure new))) + (if (set-contains? newest old) + 'ancestor + (let* ((seen (list->setq (commit-parents new))) + (oldest (commit-closure old seen))) + (if (set-contains? oldest new) + 'descendant + 'unrelated)))))))) -(define (commit-descendant? new old) - "Return true if NEW is the descendant of one of OLD, a list of commits. - -When the expected result is likely #t, this is faster than using -'commit-relation' since fewer commits need to be traversed." - (let ((old (list->setq old))) - (let loop ((commits (list new)) - (visited (setq))) - (match commits - (() - #f) - (_ - ;; Perform a breadth-first search as this is likely going to - ;; terminate more quickly than a depth-first search. - (let ((commits (remove (cut set-contains? visited <>) commits))) - (or (any (cut set-contains? old <>) commits) - (loop (append-map commit-parents commits) - (fold set-insert visited commits))))))))) +(define commit-descendant? + (if (resolve-module '(guix graph) #:ensure #f) ;Guile-Git >= 0.10.0 + (lambda (new old) + "Return true if NEW is the descendant of one of OLD, a list of +commits." + (let ((repository (commit-owner new)) + (new (commit-id new))) + (any (lambda (old) + (let ((old (commit-id old))) + (or (graph-descendant? repository new old) + (oid=? old new)))) + old))) + (lambda (new old) ;remove when Guile-Git 0.10.0 is widespread + (let ((old (list->setq old))) + (let loop ((commits (list new)) + (visited (setq))) + (match commits + (() + #f) + (_ + ;; Perform a breadth-first search as this is likely going to + ;; terminate more quickly than a depth-first search. + (let ((commits (remove (cut set-contains? visited <>) commits))) + (or (any (cut set-contains? old <>) commits) + (loop (append-map commit-parents commits) + (fold set-insert visited commits))))))))))) ;; -- 2.49.0
guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
:bug#77875
; Package guix-patches
.
Full text available.Received: (at submit) by debbugs.gnu.org; 17 Apr 2025 20:20:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 17 16:20:37 2025 Received: from localhost ([127.0.0.1]:48566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u5Viv-0006JQ-0m for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:20:37 -0400 Received: from lists.gnu.org ([2001:470:142::17]:49518) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1u5Vip-0006Ha-08 for submit <at> debbugs.gnu.org; Thu, 17 Apr 2025 16:20:34 -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 <ludo@HIDDEN>) id 1u5Vic-0005fZ-Ii for guix-patches@HIDDEN; Thu, 17 Apr 2025 16:20:24 -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 1u5ViZ-0000bB-67; Thu, 17 Apr 2025 16:20:16 -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:Subject:To:From:in-reply-to: references; bh=dG+m/YzPYlKGgbqTnFfMXWVM4r0gWRNR3YXE+eeh/Z0=; b=P/Yn1/D/2K4O41 Y5YBGI/YpTS6CDJINajpBLl6zgJ+s6PQoRwSLcoB6OwuuGAQLD8ZXGNx5+IyZE7W211u8E4biOi42 PuWBoPlQcbPCnnYnrgKh3POTytoY5Slnz3EzmPFDfXXR4e2h8QM2Zm1q9mRoZ/efiVDzQmmAikuLz KIf1M3JSyThBdUCSVWbznmS/L7MzwEW51oFfSLFBEDOHfWHnKQykehi3ZZrxOZS11DaiKxQEeFdBR VOs286DXVAiSuKxyK4OEacnU/W+W6Ofh1a2DNkX/DdSTPuikuK74yLgJ/SCEoRcvqbxucVmEjRM7k DtZfjdQa6GYlIdhXeu7g==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN> To: guix-patches@HIDDEN Subject: [PATCH 0/2] Use 'graph-descendant?' from Guile-Git instead of custom code Date: Thu, 17 Apr 2025 22:19:58 +0200 Message-ID: <cover.1744920951.git.ludo@HIDDEN> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN> Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN>, Tomas Volf <~@wolfsden.cz> 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 (-) Hello, This is a bug fix and potentially a performance improvement (I didn’t attempt to benchmark it but if someone wants to do it, I’m curious!). Note that the existing code is kept around for now. We can remove it in a couple of months when Guile-Git 0.10.0 is considered widespread enough. This is a convenience for developers since in practice Guix itself will have switched to Guile-Git 0.10.0 within a few hours. Thanks, Ludo’. Ludovic Courtès (2): git: Use ‘graph-descendant?’ from Guile-Git >= 0.10.0 when available. git: Remove compatibility shim for Guile-Git <= 0.5.2. guix/git.scm | 90 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 38 deletions(-) base-commit: 4bd2949cfa7a8bf5dfe66adad1a76472af09708d -- 2.49.0
Ludovic Courtès <ludo@HIDDEN>
:guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
.
Full text available.guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN
:bug#77875
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.