GNU bug report logs - #64737
[PATCH 1/2] git: Clarify commit relation reference in doc.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Thu, 20 Jul 2023 03:31:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64737 in the body.
You can then email your comments to 64737 AT debbugs.gnu.org in the normal way.

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

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


Report forwarded to mail <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#64737; Package guix-patches. (Thu, 20 Jul 2023 03:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to mail <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org. (Thu, 20 Jul 2023 03:31:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org,
	maxim.cournoyer <at> gmail.com
Subject: [PATCH 1/2] git: Clarify commit relation reference in doc.
Date: Wed, 19 Jul 2023 23:28:49 -0400
* guix/git.scm (update-cached-checkout): Clarify that it is the relation of
STARTING-COMMIT that is returned, relative to the new commit, not the other
way around.
---

 guix/git.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/git.scm b/guix/git.scm
index be20cde019..dbc3b7caa7 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -439,7 +439,7 @@ (define* (update-cached-checkout url
                                    #:recursive? recursive?)))
   "Update the cached checkout of URL to REF in CACHE-DIRECTORY.  Return three
 values: the cache directory name, and the SHA1 commit (a string) corresponding
-to REF, and the relation of the new commit relative to STARTING-COMMIT (if
+to REF, and the relation of STARTING-COMMIT relative to the new commit (if
 provided) as returned by 'commit-relation'.
 
 REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value

base-commit: 1d837aaa32a3a2de8f4a1ac391f92effba50834e
-- 
2.41.0





Information forwarded to mail <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#64737; Package guix-patches. (Thu, 20 Jul 2023 03:32:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org,
	maxim.cournoyer <at> gmail.com
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 2/2] scripts: time-machine: Error when attempting to visit too
 old commits.
Date: Wed, 19 Jul 2023 23:28:51 -0400
* doc/guix.texi (Invoking guix time-machine): Document limitation.
* guix/scripts/time-machine.scm (%oldest-possible-commit): New variable.
(guix-time-machine): Raise an error when the channel commit is too old.

Suggested-by: Simon Tournier <zimon.toutoune <at> gmail.com>
---

 doc/guix.texi                 |  6 ++++++
 guix/scripts/time-machine.scm | 23 ++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 1d8ebcd72f..30fef813c0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5056,6 +5056,12 @@ Invoking guix time-machine
 large number of packages; the result is cached though and subsequent
 commands targeting the same commit are almost instantaneous.
 
+Due to @command{guix time-machine} relying on the ``inferiors''
+mechanism (@pxref{Inferiors}), the oldest commit it can travel to is
+commit @samp{2ca299caf} (``Add (guix inferior) and (guix scripts
+repl).''), dated July 10 <at> sup{th}, 2018.  An error is returned when
+attempting to navigate to older commits.
+
 @quotation Note
 The history of Guix is immutable and @command{guix time-machine}
 provides the exact same software as they are in a specific Guix
diff --git a/guix/scripts/time-machine.scm b/guix/scripts/time-machine.scm
index d7c71ef705..36a40a1538 100644
--- a/guix/scripts/time-machine.scm
+++ b/guix/scripts/time-machine.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2019 Konrad Hinsen <konrad.hinsen <at> fastmail.net>
 ;;; Copyright © 2019, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,13 +20,15 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix scripts time-machine)
+  #:use-module (guix channels)
+  #:use-module (guix diagnostics)
   #:use-module (guix ui)
   #:use-module (guix scripts)
   #:use-module (guix inferior)
   #:use-module (guix store)
   #:use-module (guix status)
   #:use-module ((guix git)
-                #:select (with-git-error-handling))
+                #:select (update-cached-checkout with-git-error-handling))
   #:use-module ((guix utils)
                 #:select (%current-system))
   #:use-module ((guix scripts pull)
@@ -38,9 +41,16 @@ (define-module (guix scripts time-machine)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
+  #:use-module (srfi srfi-71)
   #:export (guix-time-machine))
 
+;;; The commit introducing the 'inferiors' mechanism; it is the oldest commit
+;;; that can be travelled to.
+(define %oldest-possible-commit
+  "2ca299caf64489f4e1e665ec1158fb0309b0b565")
+
 
 ;;;
 ;;; Command-line options.
@@ -139,9 +149,20 @@ (define-command (guix-time-machine . args)
     (with-git-error-handling
      (let* ((opts         (parse-args args))
             (channels     (channel-list opts))
+            (guix-channel (find guix-channel? channels))
             (command-line (assoc-ref opts 'exec))
+            (ref          (assoc-ref opts 'ref))
+            (checkout commit relation (update-cached-checkout
+                                       (channel-url guix-channel)
+                                       #:ref (or ref '())
+                                       #:starting-commit
+                                       %oldest-possible-commit))
             (substitutes?  (assoc-ref opts 'substitutes?))
             (authenticate? (assoc-ref opts 'authenticate-channels?)))
+       (unless (memq relation '(ancestor self))
+         (raise (formatted-message
+                 (G_ "cannot travel past commit `~a' from July 10th, 2018")
+                 (string-take %oldest-possible-commit 12))))
        (when command-line
          (let* ((directory
                  (with-store store
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#64737; Package guix-patches. (Fri, 21 Jul 2023 17:54:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: Re: [PATCH 2/2] scripts: time-machine: Error when attempting to
 visit too old commits.
Date: Fri, 21 Jul 2023 13:52:51 -0400
Hi,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> * doc/guix.texi (Invoking guix time-machine): Document limitation.
> * guix/scripts/time-machine.scm (%oldest-possible-commit): New variable.
> (guix-time-machine): Raise an error when the channel commit is too old.

So I did the following test:

$ guix time-machine --commit=2ca299caf -- shell hello -- hello

which after building Guile 2.2.4 crashed with:

--8<---------------cut here---------------start------------->8---
construction de /gnu/store/rj2g4x23lqyaq16471qm94xp90slxp3h-compute-guix-derivation.drv...
|déchargement de la construction de /gnu/store/rj2g4x23lqyaq16471qm94xp90slxp3h-compute-guix-derivation.drv sur « 10.0.0.7 »
Computing Guix derivation for 'x86_64-linux'...  Backtrace:
-           5 (primitive-load "/gnu/store/b70mihsj9xx0xxp6izliqb5vm4…")
In ice-9/eval.scm:
    155:9  4 (_ _)
    159:9  3 (_ #(#(#(#(#(#(#(#(#(#(#(…) …) …) …) …) …) …) …) …) …) …))
   173:47  2 (_ #(#(#(#(#(#(#(#(#(#(#(…) …) …) …) …) …) …) …) …) …) …))
In ./guix/self.scm:
    932:4  1 (guix-derivation "/gnu/store/yfn2s94i5bvwr7j7r6xcnivwg…" …)
    903:2  0 (guile-for-build "3.0")

./guix/self.scm:903:2: In procedure guile-for-build:
Throw to key `match-error' with args `("match" "no matching pattern" "3.0")'.
Backtrace:
In ice-9/boot-9.scm:
  1752:10 19 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
   659:37 18 (thunk)
In guix/status.scm:
    839:4 17 (call-with-status-report _ _)
In guix/store.scm:
   1298:8 16 (call-with-build-handler #<procedure 7fbf6ea46930 at g…> …)
  2168:25 15 (run-with-store #<store-connection 256.99 7fbf7448ea50> …)
In guix/inferior.scm:
    927:8 14 (_ _)
In guix/channels.scm:
    982:2 13 (_ _)
    924:2 12 (_ _)
In ./guix/monads.scm:
    487:9 11 (_ _)
In guix/store.scm:
   1996:8 10 (_ _)
In guix/channels.scm:
   675:14  9 (_ #<store-connection 256.99 7fbf7448ea50>)
In guix/store.scm:
  2168:25  8 (run-with-store #<store-connection 256.99 7fbf7448ea50> …)
   1298:8  7 (call-with-build-handler _ _)
   1298:8  6 (call-with-build-handler #<procedure 7fbf6f7bd8d0 at g…> …)
In guix/channels.scm:
   690:14  5 (_)
In guix/store.scm:
  2168:25  4 (run-with-store #<store-connection 256.99 7fbf7448ea50> …)
In ice-9/eval.scm:
   191:27  3 (_ #(#(#<directory (build-self) 7fbf6c40d960> #<pr…>) …))
In ice-9/boot-9.scm:
   2007:7  2 (error _ . _)
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
invalid build result (#<derivation /gnu/store/rj2g4x23lqyaq16471qm94xp90slxp3h-compute-guix-derivation.drv => /gnu/store/b70mihsj9xx0xxp6izliqb5vm462yifl-compute-guix-derivation 7fbf5bf82c30> "")
--8<---------------cut here---------------end--------------->8---

Thoughts?

-- 
Thanks,
Maxim




bug closed, send any further explanations to 64737 <at> debbugs.gnu.org and Maxim Cournoyer <maxim.cournoyer <at> gmail.com> Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 Sep 2023 17:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Oct 2023 11:24:07 GMT) Full text and rfc822 format available.

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

Previous Next


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