From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id YNtuN90p3mRiHAAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 16:08:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ELU/N90p3mTZCwAA9RJhRA (envelope-from ) for ; Thu, 17 Aug 2023 16:08:29 +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 73C5151BD4 for ; Thu, 17 Aug 2023 16:08:29 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=o8I4hMCD; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692281309; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=YYJuyaRyJLT5omVyNSNwnUYL7cbOXodIxSTQRdJNy4E=; b=TM97YwX33Vq2vl7LM0Hkc7GTHM4LffbdofTQW0vzEg9yWqFcEj+0kJJ/4QQ0R2a6r+Q6zr 6Qam9ZLLSR5ZvExM4GuS0MbH3quvB+tIa//jNDN/IY75KIZyUcKvXKbx+kMgTrVG459h8j tkLgsl3q6hlvo3tSFypU5g/N1kRz21Lpfru2ImXTauOIB1r87GBVPQKCzjjEi9TN6VXNYJ IhSawkCGo3E64SxkV6mMDlDoYFJ41vqqT3Ou25N9g05dqVq35nvW+ios1jUBfLpNeGhFzO 2j5zuTeWtlBKwhtcEj0oczMTOfmSgdqvxmEm1e0v89M1BcQIK5Rkt29BKOrugw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692281309; a=rsa-sha256; cv=none; b=uky+aUfib+Zw9LNanvtuy5DCZqxziHx55aOVfCl1vXpg4DP7LCOcA3kccdUi1D4D+zr5bF NMy8NJz/m419iPKMRrDOQnk43Rlv2Wywdc9zS/KGXrEjiIZicmg+GGMuquyBOslQosobUW Y6wGdPlJFxnUhYsSgqPxNSeAB0c05XR40QM1Pl9DgOm1wJM61m/ozCdlpCmv0SbEhYQQ3M Vfr2neris66GvZ888SAMUZLjqUK4p/ZLZCNO2BaeGFKrk7ghXzx6JJtSlrYpIoQCGuWB55 TZpIBFTe3Htl6fPZvZRqG0sxkz6qYwzVU56pvu5wVuDIP1Q/DYZXXYav9ijATg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=o8I4hMCD; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWdfQ-0005A4-VN; Thu, 17 Aug 2023 10:08:04 -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 1qWdfP-000598-IJ for guix-patches@gnu.org; Thu, 17 Aug 2023 10:08:03 -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 1qWdfO-0006Ck-V8; Thu, 17 Aug 2023 10:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWdfO-0007Xl-Lv; Thu, 17 Aug 2023 10:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65352] Fix time-machine and network Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Thu, 17 Aug 2023 14:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65352 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 65352@debbugs.gnu.org Cc: Maxim Cournoyer , ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Maxim Cournoyer , ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169228124828935 (code B ref -1); Thu, 17 Aug 2023 14:08:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Aug 2023 14:07:28 +0000 Received: from localhost ([127.0.0.1]:45258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWdep-0007Wd-VF for submit@debbugs.gnu.org; Thu, 17 Aug 2023 10:07:28 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWdem-0007WO-6r for submit@debbugs.gnu.org; Thu, 17 Aug 2023 10:07:26 -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 1qWdeb-0004IC-Cs for guix-patches@gnu.org; Thu, 17 Aug 2023 10:07:13 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWdeX-00064r-Ov for guix-patches@gnu.org; Thu, 17 Aug 2023 10:07:12 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe5c552dd0so16677995e9.0 for ; Thu, 17 Aug 2023 07:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692281227; x=1692886027; h=content-transfer-encoding:mime-version:message-id:date:references :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=YYJuyaRyJLT5omVyNSNwnUYL7cbOXodIxSTQRdJNy4E=; b=o8I4hMCDzDh5Qjp7ip/7/+LVAMCowNEbcl4lBWB1pXOZKj4faQFkzIzjMQR7AutCDn tc58FTjDxfSVNttUNCMrM+uIBWAueQaizoCS4ta8f1PjcWTjbk7BxMGc4of3dCBDuaxo ATHVfmG/H2QjNfqBxYWrj19ZcQ8pildwgzr0Lq5n4BBcu4IR5HVYC3rX27jF180hvJSU uOJIa/9VBu11VKXWn4l7Nrg8kF+Yk3Xs36BI1DUtgKFnqWGFUMbUd6gJTVCbs3VNbBGw TzoyJHqDDMx7mNwqFVdTOyeLi5VVnkSfTuZAKdP7iPiTeOMsRzN2cdc6696tkmn1WmfG qxFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692281227; x=1692886027; h=content-transfer-encoding:mime-version:message-id:date:references :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YYJuyaRyJLT5omVyNSNwnUYL7cbOXodIxSTQRdJNy4E=; b=NfkKDXORTzwh3q++o61lz7rHRAR78SRcT3hwu5xkUuGoc7zMdHimER9QYZ9KAglpwg Z2Ze/TxzfseZo6wbrARhkgvUe55uMHNuN1jnvnD4mQL6xVmK6RfBd/P2tfqOxDoiWm+z vuqzXkNXmqgAVPyYtZAxOsBbHrncZVKEQFlRVqfuePfTqfH8td0EW/q2fv4o2yVaNvZU YddCkyiLleq2ZbfPeSgDx7SDjn+BOjTK+EGTUSt+G1fXvHGsqTxuh/6DCADxNv/bEgAW nlsnANpXTV33AtgzJINEE4k8PXDNTfUvs7K3xBr/eKU8tJUW24b09yauowrtrzBTz+mn eksw== X-Gm-Message-State: AOJu0YwGm+d5R06roqk0qPSYKjW/mHzGx97NKtgkJnNqZZ2XFUYzOkhZ K6FdLJVjvKjvFnCGgWD2/AAAzeq4B9g= X-Google-Smtp-Source: AGHT+IEJT/g0ATQp67Jd/B1wEq/ck1WwJnguz1dplDlYocJwYvviTVdDSgT7PuN+hQpgaUcb2WNSvw== X-Received: by 2002:a05:600c:46d4:b0:3fe:5228:b78c with SMTP id q20-20020a05600c46d400b003fe5228b78cmr4599907wmo.1.1692281227298; Thu, 17 Aug 2023 07:07:07 -0700 (PDT) Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id p12-20020a05600c204c00b003fe1ca92151sm3095711wmg.26.2023.08.17.07.07.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 07:07:07 -0700 (PDT) From: Simon Tournier References: <87fs4ij0cs.fsf@gmail.com> Date: Thu, 17 Aug 2023 16:06:50 +0200 Message-ID: <87fs4h4vb9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 2.81 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: 73C5151BD4 X-Spam-Score: 2.81 X-TUID: r9M1HTYrvh9T Hi, As discussed in patch#64746, here the fix. :-) -------------------- Start of forwarded message -------------------- From: Maxim Cournoyer Date: Wed, 16 Aug 2023 14:41:55 -0400 Simon Tournier writes: > Please note that if git.savannah.gnu.org is not reachable, then =E2=80=9C= guix > time-machine=E2=80=9D fails. > > Let start with the regular: > > $ guix describe > Generation 26 Jul 12 2023 09:13:39 (current) > guix 4a027d2 > repository URL: https://git.savannah.gnu.org/git/guix.git > branch: master > commit: 4a027d2b0ee68e39f21f6802a8cd1751d3065330 > > $ guix time-machine --commit=3D4a027d2 -- describe > Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.= org/git/guix.git'... > substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% > substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... = 100.0% > building /gnu/store/sg8ca36rlbh4il6jy8dk2gr33lxm4z8q-compute-guix-derivat= ion.drv... > Computing Guix derivation for 'x86_64-linux'... | > substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% > substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... = 100.0% > The following derivations will be built: > [...] > building profile with 1 package... > guix 4a027d2 > repository URL: https://git.savannah.gnu.org/git/guix.git > commit: 4a027d2b0ee68e39f21f6802a8cd1751d3065330 > > > So far, so good. Here all is cached and so on. Now, let make > git.savannah.gnu.org unreachable by tweaking some stuff. Then, > > $ guix time-machine --commit=3D4a027d2 -- describe > guix time-machine: error: Git error: failed to resolve address for git.sa= vannah.gnu.org: Name or service not known Interesting finding! I think it'd make sense to raise this issue separately and discuss its resolution there, too keep things focused and discoverable :-). -------------------- End of forwarded message -------------------- The issue is introduced by commit dce2cf311bc12dee4560329f53ccb53470d5793e in the procedure reference-available?. The variable =E2=80=99ref=E2=80=99 is the pair (tag-or-commit . "123abc") and fails with commit-id? in (match ref ((or ('commit . commit) ('tag-or-commit . (? commit-id? commit))) Therefore, reference-available? returns #f and the =E2=80=99when=E2=80=99 b= ranch is run in update-cached-checkout. ;; Only fetch remote if it has not been cloned just before. (when (and cache-exists? (not (reference-available? repository ref))) (remote-fetch (remote-lookup repository "origin") #:fetch-options (make-default-fetch-options))) Hence the network access required by remote-fetch. Well, the heavy work to know if the reference is available or not in the local checkout is done by =E2=80=99resolve-reference=E2=80=99 in (guix git)= doing all the cases, and especially dealing with tag-or-commit: (match ref (('branch . branch) (let ((oid (reference-target (branch-lookup repository branch BRANCH-REMOTE)))) (object-lookup repository oid))) (('commit . commit) (let ((len (string-length commit))) ;; 'object-lookup-prefix' appeared in Guile-Git in Mar. 2018, so= we ;; can't be sure it's available. Furthermore, 'string->oid' use= d to ;; read out-of-bounds when passed a string shorter than 40 chars, ;; which is why we delay calls to it below. (if (< len 40) (if (module-defined? (resolve-interface '(git object)) 'object-lookup-prefix) (object-lookup-prefix repository (string->oid commit) le= n) (raise (condition (&message (message "long Git object ID is required"))))) (object-lookup repository (string->oid commit))))) (('tag-or-commit . str) (if (or (> (string-length str) 40) (not (string-every char-set:hex-digit str))) (resolve `(tag . ,str)) ;definitely a tag (catch 'git-error (lambda () (resolve `(tag . ,str))) (lambda _ ;; There's no such tag, so it must be a commit ID. (resolve `(commit . ,str)))))) (('tag . tag) (let ((oid (reference-name->oid repository (string-append "refs/tags/" tag)))) (object-lookup repository oid)))) Instead of duplicating, I propose to reuse it. See the trivial first patch. I think it fixes the annoyance. Aside, please note that (guix channels) provide commit-or-tag. It change nothing but I would find more consistent to have the same nomenclature. --8<---------------cut here---------------start------------->8--- (define (sexp->channel-news-entry entry) "Return the record corresponding to ENTRY, an sexp." (define (pair language message) (cons (symbol->string language) message)) (match entry (('entry ((and (or 'commit 'tag) type) commit-or-tag) ('title ((? symbol? title-tags) (? string? titles)) ...) ('body ((? symbol? body-tags) (? string? bodies)) ...) _ ...) (channel-news-entry (and (eq? type 'commit) commit-or-tag) (and (eq? type 'tag) commit-or-tag) --8<---------------cut here---------------end--------------->8--- WDYT about tag-or-commit everywhere? Last, as I pointed in a naive comment [1], I do not think that guix/scripts/pull.scm or guix/time-machine.scm need to support both the pair (commit . x) and (tag-or-commit . x) because the value =E2=80=99ref=E2= =80=99 is set by the option. Hence the second patch. 1: https://yhetil.org/guix/87o7j7f2tb.fsf@gmail.com Let me know if I am not missing something. Cheers, simon