Message ID | 86a5tqzze6.fsf@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DCFAF27BBEA; Wed, 13 Sep 2023 23:53:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 01F7127BBE9 for <patchwork@mira.cbaines.net>; Wed, 13 Sep 2023 23:53:39 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1qgYjD-00036i-0o; Wed, 13 Sep 2023 18:52:59 -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 <Debian-debbugs@debbugs.gnu.org>) id 1qgYjB-000366-6e for guix-patches@gnu.org; Wed, 13 Sep 2023 18:52:57 -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 <Debian-debbugs@debbugs.gnu.org>) id 1qgYjA-000124-VP for guix-patches@gnu.org; Wed, 13 Sep 2023 18:52:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1qgYjF-0005Mx-TZ for guix-patches@gnu.org; Wed, 13 Sep 2023 18:53:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65352] Fix time-machine and network Resent-From: Simon Tournier <zimon.toutoune@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 13 Sep 2023 22:53:01 +0000 Resent-Message-ID: <handler.65352.B65352.169464554720578@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65352 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Cc: 65352@debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@gmail.com> Received: via spool by 65352-submit@debbugs.gnu.org id=B65352.169464554720578 (code B ref 65352); Wed, 13 Sep 2023 22:53:01 +0000 Received: (at 65352) by debbugs.gnu.org; 13 Sep 2023 22:52:27 +0000 Received: from localhost ([127.0.0.1]:36296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1qgYih-0005Lk-2m for submit@debbugs.gnu.org; Wed, 13 Sep 2023 18:52:27 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:39175) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <zimon.toutoune@gmail.com>) id 1qgYid-0005LT-AW for 65352@debbugs.gnu.org; Wed, 13 Sep 2023 18:52:26 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-403c5bcffc4so911245e9.1 for <65352@debbugs.gnu.org>; Wed, 13 Sep 2023 15:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694645532; x=1695250332; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IBhjqwB2hC2JQoQ/JMbcvE1d5lXrBnXkJBzAwom+G9c=; b=RbWMEO4cGY4vSkaATsIjhxyOQhv96uaE1ntN5RlQ/a1K2F9WK+4dGbDgb09gITk203 QKtKecE9e6GdQAgtwDJoN03A8BPAvbWXn0WiRH321l6w40pJ9tMK/jEzRfjt1PsGzVrX o/bAN73ldq+QKHlW29BFNqDMmrZESU9TehdPh6tM796bgZoQ05djSo+9Y8QebYEFFZ2+ BPXFUUUoBY1t5jFHvXFU1HgN6NC/PIEkswtrAdG/A0vqqYscy8Z0/v84aWVNKxgAKHl1 uMEPPDMpy6iiJCtfaSF3/2U5TIWQruXn6IwXoNyY1F1nCei0gju9WflbW3te9ao4U3jy w6AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694645532; x=1695250332; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IBhjqwB2hC2JQoQ/JMbcvE1d5lXrBnXkJBzAwom+G9c=; b=Ph34fQzDiMHe/dvvjDFFdw6/Hk99I3OAw6727L7NW7a6kPNwk+s4YMfesVhEBDqT2w yyQpkjJYNLPRgHK7NuNuRzctkPAjWBxgSF49hBruMl2mh8SSasb+Vukab210CZN7mJ41 EpH4DS2bkOLX7zbcy0tLuSQhCbbzv/qqmtq5blQidGhbDgf0q1jEtt5U2rh57/02VxuH fhgianydhXufHeqOAUW/SLXP2lIApohmgU6vxXiZtr+o73dPhPcGpsQgeEV+1Y8C4rw7 ABHvffSYfBuW8xzPctxEBYtt5QRNQLZeGpIXWlRZoslNnFr7lK9Q3RA2mCDncEuHuHPG 0p3Q== X-Gm-Message-State: AOJu0Yz+bPEBOgma4IJyBpUYhmnIYo3cwQ3LIUmJF9xXg+xaJnEQQyR9 GLjIYvUzMaaPOOjX7s8qcOc= X-Google-Smtp-Source: AGHT+IGi/KEEdP8ZkKHcUkZe7bgGnoUFLHziix5hMmCVrP9Ckd1e6l3MSNmwC1tCByGIn9Lb2HlYiQ== X-Received: by 2002:adf:ebc8:0:b0:317:7238:336a with SMTP id v8-20020adfebc8000000b003177238336amr3015358wrn.5.1694645531645; Wed, 13 Sep 2023 15:52:11 -0700 (PDT) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id x2-20020adfec02000000b003179d7ed4f3sm95419wrn.12.2023.09.13.15.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 15:52:11 -0700 (PDT) From: Simon Tournier <zimon.toutoune@gmail.com> In-Reply-To: <875y4dltgm.fsf_-_@gnu.org> References: <86ledjoaly.fsf@gmail.com> <32d3fb5066e0b20e200dabef0fba897634e21dda.1694009405.git.zimon.toutoune@gmail.com> <875y4dltgm.fsf_-_@gnu.org> Date: Wed, 13 Sep 2023 02:32:17 +0200 Message-ID: <86a5tqzze6.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#65352] Fix time-machine and network
|
|
Commit Message
Simon Tournier
Sept. 13, 2023, 12:32 a.m. UTC
Hi Ludo, On Wed, 13 Sep 2023 at 22:16, Ludovic Courtès <ludo@gnu.org> wrote: >> + (('commit . (? commit-id? commit)) >> + (let ((oid (string->oid commit))) >> + (->bool (commit-lookup repository oid)))) >> + ((or ('tag . str) >> + ('tag-or-commit . str)) >> + (false-if-git-not-found >> + (->bool (resolve-reference repository ref)))) > > IIUC, the differences compared to what we had are: > > 1. 'tag references are now handled on the fast path > (‘reference-available?’ can return #t); > > 2. short commit strings are now always on the slow path > (‘reference-available?’ always returns #f). > > Is that correct? No, or I am missing some details. > It would be nice to have #1 without #2. It’s already the case because of that: (option '("commit") #t #f (lambda (opt name arg result) (alist-cons 'ref `(tag-or-commit . ,arg) result))) Currently, the heuristic to determine if it is a tag or a commit is implemented by ’resolve-reference’. Somehow, considering the command-line parser, the alternative is: #1 and #2 on the fast path (the patch) or #1 and #2 on the slow path (the current implementation) Let ’pk’ (see below) to convince you. :-) Before the proposed patch: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix time-machine --commit=v1.4.0 -- describe ;;; (ref (tag-or-commit . "v1.4.0")) ;;; (reference-available? #f) ;;; (remote-fetch NETWORK) C-c C-c $ ./pre-inst-env guix time-machine --commit=8e2f32c -- describe ;;; (ref (tag-or-commit . "8e2f32c")) ;;; (reference-available? #f) ;;; (remote-fetch NETWORK) C-c C-c --8<---------------cut here---------------end--------------->8--- After the proposed patch: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix time-machine --commit=v1.4.0 -- describe ;;; (ref (tag-or-commit . "v1.4.0")) ;;; (reference-available? #t) guix 8e2f32c repository URL: https://git.savannah.gnu.org/git/guix.git commit: 8e2f32cee982d42a79e53fc1e9aa7b8ff0514714 $ ./pre-inst-env guix time-machine --commit=8e2f32c -- describe ;;; (ref (tag-or-commit . "8e2f32c")) ;;; (reference-available? #t) guix 8e2f32c repository URL: https://git.savannah.gnu.org/git/guix.git commit: 8e2f32cee982d42a79e53fc1e9aa7b8ff0514714 --8<---------------cut here---------------end--------------->8--- Cheers, simon --8<---------------cut here---------------start------------->8--- --8<---------------cut here---------------end--------------->8---
Comments
Hi, Simon Tournier <zimon.toutoune@gmail.com> skribis: > On Wed, 13 Sep 2023 at 22:16, Ludovic Courtès <ludo@gnu.org> wrote: > >>> + (('commit . (? commit-id? commit)) >>> + (let ((oid (string->oid commit))) >>> + (->bool (commit-lookup repository oid)))) >>> + ((or ('tag . str) >>> + ('tag-or-commit . str)) >>> + (false-if-git-not-found >>> + (->bool (resolve-reference repository ref)))) >> >> IIUC, the differences compared to what we had are: >> >> 1. 'tag references are now handled on the fast path >> (‘reference-available?’ can return #t); >> >> 2. short commit strings are now always on the slow path >> (‘reference-available?’ always returns #f). >> >> Is that correct? > > No Sorry, could you explain what the difference is then on the hunk I quoted? https://issues.guix.gnu.org/65352#34-lineno11 I see different treatment of short commit IDs and tags, and no difference for full commit IDs. Thanks, Ludo’.
Hi again, Simon Tournier <zimon.toutoune@gmail.com> skribis: > Let ’pk’ (see below) to convince you. :-) > > Before the proposed patch: > > $ ./pre-inst-env guix time-machine --commit=v1.4.0 -- describe > > ;;; (ref (tag-or-commit . "v1.4.0")) > > ;;; (reference-available? #f) > > ;;; (remote-fetch NETWORK) > C-c C-c > > $ ./pre-inst-env guix time-machine --commit=8e2f32c -- describe > > ;;; (ref (tag-or-commit . "8e2f32c")) > > ;;; (reference-available? #f) > > ;;; (remote-fetch NETWORK) > C-c C-c Yes this seems to confirm what I thought. So anyway, go for it! Great that you’re improving performance here. Ludo’.
Hi, On Thu, 14 Sept 2023 at 11:04, Ludovic Courtès <ludo@gnu.org> wrote: > Yes this seems to confirm what I thought. Hum, maybe we have miscommunicated because we were speaking on different levels, I guess. :-) By 'tag references, you meant (tag . "foo") right? And that case is not possible from the command-line and even I am not sure about the use-case of passing (tag . "foo") to reference-available?. Another story. Reconsidering your question, yes the case (tag . "foo") is currently on the fast path and will stay on the fast path. I have read "tag references" as the user is passing a Git tag. Which is currently managed the same way as short commit ID. Hence my previous answer. :-) > So anyway, go for it! Cool! I will proceed. > Great that you’re improving performance here. Now, we can give a look to bug#65787 [1]. ;-) 1: bug#65787: time-machine is doing too much network requests Simon Tournier <zimon.toutoune@gmail.com> Mon, 11 Sep 2023 11:41:54 +0200 id:87tts1jbbx.fsf@gmail.com https://yhetil.org/guix/87tts1jbbx.fsf@gmail.com https://issues.guix.gnu.org/msgid/87tts1jbbx.fsf@gmail.com Cheers, simon
Hi, On Thu, 14 Sep 2023 at 11:42, Simon Tournier <zimon.toutoune@gmail.com> wrote: >> So anyway, go for it! > > Cool! I will proceed. Done with 6d33c1f8061e86d63ab5c9ec75df9c58130c7264. Cheers, simon
Hi, Ludovic Courtès <ludo@gnu.org> skribis: > Yes this seems to confirm what I thought. > > So anyway, go for it! Apologies, I clearly lost track of what I was saying. There are two things we missed here: 1. ‘false-if-git-not-found’ was removed around the call to ‘commit-lookup’, which breaks things as reported just today on IRC. Could you reintroduce it? 2. Short commit IDs are no longer handled in the 'commit case, as I mentioned before in this thread (and then forgot). Could you reintroduce support for them? (Cc’ing Chris who’s been debugging it and discussing it on IRC.) Thanks, Ludo’.
Hi, On Mon, 25 Sept 2023 at 11:32, Ludovic Courtès <ludo@gnu.org> wrote: > 1. ‘false-if-git-not-found’ was removed around the call to > ‘commit-lookup’, which breaks things as reported just today on > IRC. Could you reintroduce it? About "guix system"? Yes, for sure let reintroduce it. But I miss why it would work for one case and not for the other. I was looking at 'check-forward-update'. > 2. Short commit IDs are no longer handled in the 'commit case, as I > mentioned before in this thread (and then forgot). Could you > reintroduce support for them? Short commit ID are handled by tag-or-commit (guix time-machine and guix pull). If there is a discrepancy elsewhere with short commit ID, it should be fixed overthere, IMHO. Else, I do not understand what you are asking. From my understanding, it would not make sense to have short commit ID handled with (commit . "abc123") for some part of the code and (tag-or-commit . "abc123") for some other part. Cheers, simon
Re On Mon, 25 Sept 2023 at 11:57, Simon Tournier <zimon.toutoune@gmail.com> wrote: > On Mon, 25 Sept 2023 at 11:32, Ludovic Courtès <ludo@gnu.org> wrote: > > > 1. ‘false-if-git-not-found’ was removed around the call to > > ‘commit-lookup’, which breaks things as reported just today on > > IRC. Could you reintroduce it? [...] > Yes, for sure let reintroduce it. Done with 94f3831e5bb1e04eeb3a0e7d31a0675208ce6f4c. Cheers, simon
Simon Tournier <zimon.toutoune@gmail.com> skribis: > On Mon, 25 Sept 2023 at 11:32, Ludovic Courtès <ludo@gnu.org> wrote: > >> 1. ‘false-if-git-not-found’ was removed around the call to >> ‘commit-lookup’, which breaks things as reported just today on >> IRC. Could you reintroduce it? > > About "guix system"? > > Yes, for sure let reintroduce it. > > But I miss why it would work for one case and not for the other. I > was looking at 'check-forward-update'. ‘commit-lookup’ throws to 'git-error when passed a commit that is not found, that’s why. >> 2. Short commit IDs are no longer handled in the 'commit case, as I >> mentioned before in this thread (and then forgot). Could you >> reintroduce support for them? > > Short commit ID are handled by tag-or-commit (guix time-machine and > guix pull). If there is a discrepancy elsewhere with short commit ID, > it should be fixed overthere, IMHO. > > Else, I do not understand what you are asking. From my understanding, > it would not make sense to have short commit ID handled with (commit . > "abc123") for some part of the code and (tag-or-commit . "abc123") for > some other part. It the caller passes (commit . "1234"), this is no longer handled efficiently as it used to be. Maybe that’s a bit of a theoretical issue though because in practice CLIs would pass (tag-or-commit . "1234"), right? Thanks for your quick response! Ludo’.
Hi, On Mon, 25 Sep 2023 at 17:01, Ludovic Courtès <ludo@gnu.org> wrote: >>> 2. Short commit IDs are no longer handled in the 'commit case, as I >>> mentioned before in this thread (and then forgot). Could you >>> reintroduce support for them? >> >> Short commit ID are handled by tag-or-commit (guix time-machine and >> guix pull). If there is a discrepancy elsewhere with short commit ID, >> it should be fixed overthere, IMHO. >> >> Else, I do not understand what you are asking. From my understanding, >> it would not make sense to have short commit ID handled with (commit . >> "abc123") for some part of the code and (tag-or-commit . "abc123") for >> some other part. > > It the caller passes (commit . "1234"), this is no longer handled > efficiently as it used to be. > > Maybe that’s a bit of a theoretical issue though because in practice > CLIs would pass (tag-or-commit . "1234"), right? Well, to my knowledge, ’guix pull’ and ’guix time-machine’ pass 'tag-or-commit for short commit ID. Somehow, that’s the beginning of all this. :-) The story starts with 79ec651a286c71a3d4c72be33a1f80e76a560031 and ecab937897385fce3e3ce0c5f128afba4304187c: (option '("commit") #t #f (lambda (opt name arg result) - (alist-cons 'ref `(commit . ,arg) result))) + (alist-cons 'ref `(tag-or-commit . ,arg) result))) and then I just try to keep consistent some rest with these changes, cleaning unnecessary network access. The root of all is maybe this change f36522416e69d95f222fdfa6404d1981eb5225b6, introducing tag-or-commit. Having all that in mind, we have to make clear how to internally represent a short commit ID: + either (commit . "1234") + either (tag-or-commit . "1234") but not both. It appears to me a slippery slope with potential nasty bugs if we mix the both. From a CLI point of view, say “guix pull --comnit=foo123”, it is hard to know beforehand if “foo123“ is a tag or a short commit ID, hence the representation (tag-or-commit . "foo123") then resolved by the heuristic implemented by ’resolve-reference’; as nicely implemented by f36522. :-) Now, if elsewhere in the Guix code base, something is reading ‘foo123’ and constructs (commit . "foo123") in order to pass it to ’update-cached-checkout’, my opinion is that we need to correct it and instead construct (tag-or-commit . "foo123"). Somehow, be in agreement with 79ec65, ecab93 and f36522. :-) To conclude, we had all this long thread discussion, partially because REF is not explicitly specified but implicitly used here or there. Therefore, to end this lengthy thread, I propose to send a patch documenting these cases. For example, update the docstring of reference-available?. Well, let close this « Fix time-machine and network » since it is done, I guess. And open another one for this discussion about short commit ID internal representation. WDYT? Cheers, simon
diff --git a/guix/git.scm b/guix/git.scm index 1cb87a45607b..c927555cce18 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -481,6 +481,8 @@ (define* (update-cached-checkout url (repository-open cache-directory) (clone/swh-fallback url ref cache-directory)))) ;; Only fetch remote if it has not been cloned just before. + (pk 'ref ref) + (pk 'reference-available? (reference-available? repository ref)) (when (and cache-exists? (not (reference-available? repository ref))) (remote-fetch (remote-lookup repository "origin")