summary refs log tree commit diff
path: root/guix/describe.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-09-19 16:26:44 +0200
committerLudovic Courtès <ludo@gnu.org>2020-09-19 22:52:36 +0200
commit1b179d7876f19f04009a2f9e248ac10711f4c660 (patch)
treed3dfb99a2c0eaee62c32f647b93ceb65b9a2a778 /guix/describe.scm
parent0996fcc657593955845c2761d7eb0f656149fe11 (diff)
downloadguix-1b179d7876f19f04009a2f9e248ac10711f4c660.tar.gz
describe: Save the original value of (program-arguments).
Fixes <https://bugs.gnu.org/42688>.
Reported by pkill9 <pkill9@runbox.com>.

This ensures that 'guix repl -s SCRIPT' give SCRIPT the right value
of (current-profile), which in turn ensures that (%package-module-path)
is initialized with the right set of channels.

* guix/describe.scm (initial-program-arguments): New variable.
(current-profile): Use it.
* guix/scripts/repl.scm (guix-repl): Call 'current-profile' before
'set-program-arguments'.
Diffstat (limited to 'guix/describe.scm')
-rw-r--r--guix/describe.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/guix/describe.scm b/guix/describe.scm
index 6b9b219113..05bf99eb58 100644
--- a/guix/describe.scm
+++ b/guix/describe.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,11 +43,17 @@
 ;;;
 ;;; Code:
 
+(define initial-program-arguments
+  ;; Save the initial program arguments.  This allows us to see the "real"
+  ;; 'guix' program, even if 'guix repl -s' calls 'set-program-arguments'
+  ;; later on.
+  (program-arguments))
+
 (define current-profile
   (mlambda ()
     "Return the profile (created by 'guix pull') the calling process lives in,
 or #f if this is not applicable."
-    (match (command-line)
+    (match initial-program-arguments
       ((program . _)
        (and (string-suffix? "/bin/guix" program)
             ;; Note: We want to do _lexical dot-dot resolution_.  Using ".."