GNU bug report logs - #74584
wrong pull/time-machine message when channels.scm does not exit

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Simon Tournier <zimon.toutoune@HIDDEN>; dated Thu, 28 Nov 2024 08:25:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Nov 2024 08:24:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 28 03:24:54 2024
Received: from localhost ([127.0.0.1]:36501 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tGZpV-0002yk-Ec
	for submit <at> debbugs.gnu.org; Thu, 28 Nov 2024 03:24:54 -0500
Received: from lists.gnu.org ([209.51.188.17]:38826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1tGZpS-0002ya-Pf
 for submit <at> debbugs.gnu.org; Thu, 28 Nov 2024 03:24:52 -0500
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 <zimon.toutoune@HIDDEN>)
 id 1tGZpS-0006aQ-H9
 for bug-guix@HIDDEN; Thu, 28 Nov 2024 03:24:50 -0500
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1tGZpQ-0006r7-If
 for bug-guix@HIDDEN; Thu, 28 Nov 2024 03:24:50 -0500
Received: by mail-wm1-x32c.google.com with SMTP id
 5b1f17b1804b1-434a1833367so3119785e9.1
 for <bug-guix@HIDDEN>; Thu, 28 Nov 2024 00:24:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1732782287; x=1733387087; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=HD3x/OPA1yQRB2q9esFkdVZ7Zey5UbCwf11XXgDiKjs=;
 b=RALs6G2TujGoY/VHZjCKrGbKxcIKRgp6jwI8DDUt0lh7VswuL+G9HrmxE280z8yZKB
 7L+XxRpmVgCv9Fo0jBoEUQPy3VoImSXaky5u+nfQ8irMey7Quijuas5GIPrK5tk9VGC4
 eiimfO17frKv8BqcmAD32lMaR3KtEhvu0LCB+Z8uO0R93pnBYySf+TzaxdftwxwDnzci
 V1LM92cYxWQRKh6N5iAH+8z5gQ7VMJC4gNLNpe3mhZALVhQ+Ojq9bBADPns8yV82MNdn
 v9f5iWGKAF/khWKhmawoVZIRis6J6uaalhM1fhJdW2XvXMSNEqg5+wFIA23jA51CxoRW
 Ft3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1732782287; x=1733387087;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=HD3x/OPA1yQRB2q9esFkdVZ7Zey5UbCwf11XXgDiKjs=;
 b=DxkcoFQ65oGMa95NgLKvxeRXnDqWrmhRaV89T1K8QYzfy8TCjNjk9UgWf4yItBFAgf
 vDMw027H8dJF4hvgZIZzLYgMhmynCrQOtC4UxmIU76wSL71OAV7nAP6PSbiNFwdJf4RQ
 f0solk24hHULt2/2Ezi8D5x8kK9JjbN+i+BQ4b0CwbgUcHDRbPy76DUfGTtTeK0DLUTv
 L0hbxojTRyc5V6puiYhwSr8g0m5kHvqnsO8SrFbb0dpvV9yQOMk9BURMak6oL3ENU1A7
 IYcV5kTbCzPkML8vmCkNtvJmS8UXQV5ySf7I5xAehrHUQLWT7M+cgtNNKr+SuWsSA9OH
 SoZw==
X-Gm-Message-State: AOJu0YzWstGgBSItmDg719TuZK+cA5CQk0iHLjZY+sBX2zRO+HtxsbII
 FCEsgr3f31KuMS2WpfMekdJB6i2gic2AQF6tQ8JIWyJQQ81WazpZmHiFVg==
X-Gm-Gg: ASbGncvIvTpaVlXFI0KbHHby6ktCYnok4OcZq8+WdW+C742umvkFbIyeHAyFZsGdB1b
 1JEO3uD9tI6EOlCXkliOwQJ6WOpilLcTkJmJqKXbUge+TuRqhptTjZ7nG9BNgLnViy4JExKGNx8
 TGPmbTHXCjrGGhffXK8nVwSa9+OwOgTAqr7k9k93bcBlfpO3axcZ1BkKstR+4DTyXcjf2WnAc7x
 tECR5RV7zsowBFdjU4POZkVMAK9DKcYwIlhYU4r1R/TGY0q
X-Google-Smtp-Source: AGHT+IGVm9t6Hrrnb5zB/eows6ba/1tGfJUcXscxRrdj7lViNRzN2kR3jrEvxI89GSgrCxV2bMq1bQ==
X-Received: by 2002:a05:600c:198e:b0:434:9cf6:a2a5 with SMTP id
 5b1f17b1804b1-434afb9ecc7mr19172645e9.8.1732782286521; 
 Thu, 28 Nov 2024 00:24:46 -0800 (PST)
Received: from lili ([2a01:e0a:59b:9120:59d1:7e1d:65bd:62e3])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-434b0dbfaf6sm14279745e9.18.2024.11.28.00.24.45
 for <bug-guix@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 28 Nov 2024 00:24:45 -0800 (PST)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: bug-guix@HIDDEN
Subject: wrong pull/time-machine message when channels.scm does not exit
Date: Thu, 28 Nov 2024 02:26:16 +0100
Message-ID: <874j3sf8sn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::32c;
 envelope-from=zimon.toutoune@HIDDEN; helo=mail-wm1-x32c.google.com
X-Spam_score_int: -5
X-Spam_score: -0.6
X-Spam_bar: /
X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543,
 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=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.2 (/)
X-Debbugs-Envelope-To: submit
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.2 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

The =E2=80=9Cbug=E2=80=9C:

--8<---------------cut here---------------start------------->8---
$ ls channels.scm
ls: cannot access 'channels.scm': No such file or directory

$ guix time-machine -q -C channels.scm -- help
guix time-machine: error: 'channels.scm' did not return a list of channels
--8<---------------cut here---------------end--------------->8---

That=E2=80=99s incorrect.  What I expect is something as:

--8<---------------cut here---------------start------------->8---
$ ls foo.scm
ls: cannot access 'foo.scm': No such file or directory

$ guix time-machine -q -C foo.scm -- help
guix time-machine: error: failed to load 'foo.scm':
ice-9/boot-9.scm:2190:9: In procedure primitive-load-path: Unable to find f=
ile "guix/foo.scm" in load path
--8<---------------cut here---------------end--------------->8---

Although the second part can be confusing for regular user.  And
although I think the message is also incorrect.

Well, the story is about =E2=80=99load*=E2=80=99 from module (guix ui).  Us=
ing this
trivial patch with some =E2=80=99pk=E2=80=99.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=p.patch
Content-Description: trivial.patch

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 58d3cd7e83..d294df4f37 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -752,6 +752,7 @@ (define (channel-list opts)
 
   (define (load-channels file)
     (let ((result (load* file (make-user-module '((guix channels))))))
+      (pk 'load-channels result)
       (if (and (list? result) (every channel? result))
           result
           (leave (G_ "'~a' did not return a list of channels~%") file))))
diff --git a/guix/ui.scm b/guix/ui.scm
index eba12c8616..651cea4ff7 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -250,7 +250,11 @@ (define* (load* file user-module
                ;; 'primitive-load', so that FILE is compiled, which then allows
                ;; us to provide better error reporting with source line numbers.
                (without-compiler-optimizations
-                (load (try-canonicalize-path file))))
+                (begin
+                  (pk 'file file)
+                  (pk 'try-canonicalize-path (try-canonicalize-path file))
+                  (pk 'load-file (load file))
+                  (load (try-canonicalize-path file)))))
              (const #f))))))
     (lambda _
       ;; XXX: Errors are reported from the pre-unwind handler below, but
@@ -262,6 +266,7 @@ (define* (load* file user-module
          (let* ((stack (make-stack #t handle-error tag))
                 (frame (last-frame-with-source stack)))
 
+           (pk 'let-raise-error)
            (report-load-error file args frame)
 
            (case on-error

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


It reads:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix time-machine -q -C channels.scm -- help

;;; (file "channels.scm")

;;; (try-canonicalize-path "channels.scm")

;;; (load-file #<unspecified>)

;;; (load-channels #<unspecified>)
guix time-machine: error: 'channels.scm' did not return a list of channels
--8<---------------cut here---------------end--------------->8---

In other words, instead of raising an error, it returns #<unspecified>
and thus because =E2=80=99load-channels=E2=80=99 tests against =E2=80=99lis=
t?=E2=80=99 which
#<unspecified> is obviously not then bang!

Bah the easy fix is to check with =E2=80=99unspecified?=E2=80=99 directly in
=E2=80=99load-channels=E2=80=99.  But that does not really fix the issue, I=
MHO.

The issue is that because a file named channels.scm is around in
load-path.  For instance, let say the non-existent file is named
=E2=80=99packages.scm=E2=80=99:

--8<---------------cut here---------------start------------->8---
$ ls packages.scm
ls: cannot access 'packages.scm': No such file or directory

$ guix time-machine -q -C packages.scm -- help
guix time-machine: error: 'packages.scm' did not return a list of channels
--8<---------------cut here---------------end--------------->8---

In other words, is the comment accurate

               ;; Give 'load' an absolute file name so that it doesn't try =
to
               ;; search for FILE in %LOAD-PATH.

?

Well, since I am not sure to get the use case of
=E2=80=99try-canonicalize-path=E2=80=99, then I don=E2=80=99t know what cou=
ld be the best fix.
But I guess =E2=80=99canonicalize-path=E2=80=99 is not doing what we expect=
, right?

Cheers,
simon

--=-=-=--




Acknowledgement sent to Simon Tournier <zimon.toutoune@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#74584; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

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