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 aGEhC8OquGReWQAASxT56A (envelope-from ) for ; Thu, 20 Jul 2023 05:32:19 +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 GLEIC8OquGRIbQEA9RJhRA (envelope-from ) for ; Thu, 20 Jul 2023 05:32:19 +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 A646C4389B for ; Thu, 20 Jul 2023 05:32:18 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20221208 header.b=efn5hmgr; 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=1689823939; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ylrIY0bZuSTlcUf2pw742I8wMIrnFSPj4sTz6mmFQjw=; b=vDnSpCzPf9+zazRpGde6hubXXzrZFGdk2FXNonW8Ubgwznu3hNXfIabMRCM00zfR2RClom lR2MrnvIBqCK6amL+OFkv1EpQgq6ArZd8/cXbX9v3OyUYmy47x2pBqVy6fmSpiH6BhjOU6 2QwqFOFXrIl2cb6tBrVjDDWdKMNDad0zkGyNd4thLpk5hGuXTB6uh/EFShWZsJIhUtyFnZ qXtVCNlOlQWJEnJAg4WowiLdnrv8r3ezxdYdezi09J/7rQ4S8KzTp6z7VdRr40YhxTURr4 f5XCL5fpKc2fhFYayIPxYb0bx9/dvXXJK3bD8Scj6FRpQkL1QXv2lItH8MJtQg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1689823939; a=rsa-sha256; cv=none; b=h6KdD180a7kBR9ADml3HXwmZlxhQyUBTvlQgSYPftEixYSnKUEnaf3gcxUX/EZ2/tqJ0CB VCaHpmV5bJCwTd+hLtNDrQYIZB54eCjfwKzjCjUSSHTod1ZVR3pVM4xPngDpat8y0nhUEg U82g57vf5WNOvZKhHVZefWVGFcY09ECrGv2Nef7f/fbt2T+duoT7wt8AGSTz7KX0pyrDU8 eRezl4f3MMbB2UJqzuY83FWOjkXhR2/2/GShqTXg/s9ZXiajz5g+6Ht2nGhu1v9D499Ds4 eh6d1eeN6fOxsdLi1pA0CrVHKuHe9YeIVVPegh9Mfv7QPzCyykdT1evIZhWcHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20221208 header.b=efn5hmgr; 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 1qMKOc-0000G7-0M; Wed, 19 Jul 2023 23:32:06 -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 1qMKOa-0000FZ-Fy for guix-patches@gnu.org; Wed, 19 Jul 2023 23:32:04 -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 1qMKOa-0003hT-2H; Wed, 19 Jul 2023 23:32:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qMKOX-00068a-Lk; Wed, 19 Jul 2023 23:32:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64737] [PATCH 2/2] scripts: time-machine: Error when attempting to visit too old commits. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 20 Jul 2023 03:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64737 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64737@debbugs.gnu.org, maxim.cournoyer@gmail.com Cc: Simon Tournier , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org, maxim.cournoyer@gmail.com X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.168982386523526 (code B ref -1); Thu, 20 Jul 2023 03:32:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jul 2023 03:31:05 +0000 Received: from localhost ([127.0.0.1]:57417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMKNd-00067O-EB for submit@debbugs.gnu.org; Wed, 19 Jul 2023 23:31:05 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMKNX-00066N-RY for submit@debbugs.gnu.org; Wed, 19 Jul 2023 23:31: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 1qMKNR-0008LD-PS for guix-patches@gnu.org; Wed, 19 Jul 2023 23:30:53 -0400 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMKNP-0002FE-WD for guix-patches@gnu.org; Wed, 19 Jul 2023 23:30:53 -0400 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-4039a2b71c1so3177471cf.0 for ; Wed, 19 Jul 2023 20:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689823850; x=1690428650; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nNZ1aIR2FtJiGSwA7Zhg8LuLbfrjVr6S874lvlGoMEk=; b=efn5hmgrOuWTq53ocblEzCYbliUS9HkPIXj9DVVldCzRmVSgwEmYbHzhy33WxX5eTF 3Md7Tmudwh1aPv2CpChrK1WvjB6lHvqkpZcyXHIDCwcNnQPCf4g8ZPPJCGRvSBTHCtLF fSDhlHXDqszNn6xFsKq64cEgJ5x6+4ryIBZCQKZemd0OEOtazIjhsKqeJivrpO0LIfYX Yj053QUolVIA+YoERiGF7OAeDJZGA6sQp281nxS+HQCV9TECvJjh9dao5iKUM0Hms6/2 sykkQeIiCV5ATIQ7TT0a+eGMYj3dY493+9JveCtMmcQ5pMAbglDhjE8ew/6taklkftW4 BdGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689823850; x=1690428650; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nNZ1aIR2FtJiGSwA7Zhg8LuLbfrjVr6S874lvlGoMEk=; b=ZGm1hgKuRW5G5d+vhWjHONTaGRjkWPRp92zT/2EQUEp8Yen7JrCKEXWZsfwxDLYEhY DWIbzujG08GAJphRRV17sRxsncTuN+AM4MbzpRtlYr7BTMv2owfnHxyPJnCxekk60Eox ul2KvhdNKkUNV2LEEYrKMR5e5c6V8YqZKduPZwY2pVCjMeitIe8Pp3/0s9y2h9S40+09 F3QxXXndpQ8TqWTHh0ggB5IyBDeAKX+WMtQERRBDkjBLPVivZsF1qT40F/z3wEpoSD0o 1+t9PTe+m702l9UmZIh4UuupPnvtgPaD9ckBMN7j+S/uOHcRuiLvMeNk/R+fkakjFKzz dpJA== X-Gm-Message-State: ABy/qLZp1JQ9Q6lp+T4M888IAM9BDqqIOo6phwa3E8HHUo6NeADfu1tF UVZH4PYuw11O/A44exJRqBEZQD/LKzY= X-Google-Smtp-Source: APBJJlHO/xCM7o5V9EXYJNLFU1+C2pPySLVKnDhQsG0OS4nScydxqpdks5OnUvIbZYgnFOvQ3MHwfw== X-Received: by 2002:ac8:5914:0:b0:403:ae76:d0a3 with SMTP id 20-20020ac85914000000b00403ae76d0a3mr23232139qty.8.1689823850392; Wed, 19 Jul 2023 20:30:50 -0700 (PDT) Received: from localhost.localdomain (dsl-159-145.b2b2c.ca. [66.158.159.145]) by smtp.gmail.com with ESMTPSA id s15-20020ac8528f000000b003f9efa2ddb4sm31495qtn.66.2023.07.19.20.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 20:30:50 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 19 Jul 2023 23:28:51 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::830; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x830.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, T_SCC_BODY_TEXT_LINE=-0.01 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx2.migadu.com X-Migadu-Spam-Score: 5.86 X-Spam-Score: 5.86 X-Migadu-Queue-Id: A646C4389B X-TUID: EprDjRfkhE43 * 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 --- 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@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 ;;; Copyright © 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2023 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,13 +20,15 @@ ;;; along with GNU Guix. If not, see . (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