diff options
author | Thiago Jung Bauermann <bauermann@kolabnow.com> | 2021-11-11 20:46:48 -0300 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-11-14 23:18:08 +0100 |
commit | 12c06847f07b3fc530e07d4338e3959f60dbefdd (patch) | |
tree | 4455b6eecca6e69d451968ae8bac5303b03e5e19 /guix/scripts | |
parent | 0aeb7b91a81d392d3a26eede53150e46ebfef76d (diff) |
environment: Fix ‘--check’ with exported PS1 variable.
If your .bashrc (unnecessarily) exports PS1 and you’re in a non-login
shell, Guix crashes:
user@popigai:~$ guix shell --check coreutils
guix shell: checking the environment variables visible from shell '/bin/bash'...
Backtrace:
14 (primitive-load "/home/user/.config/guix/current/bin/g…")
In guix/ui.scm:
2206:7 13 (run-guix . _)
2169:10 12 (run-guix-command _ . _)
In ice-9/boot-9.scm:
1752:10 11 (with-exception-handler _ _ #:unwind? _ # _)
1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
658:37 9 (thunk)
1320:8 8 (call-with-build-handler _ _)
1320:8 7 (call-with-build-handler #<procedure 7fe393b7c420 at g…> …)
In guix/status.scm:
800:4 6 (call-with-status-report _ _)
In guix/scripts/environment.scm:
951:12 5 (_)
In guix/store.scm:
2119:24 4 (run-with-store #<store-connection 256.99 7fe39627e500> …)
In guix/scripts/environment.scm:
521:35 3 (_ _)
In unknown file:
2 (string=? ("PS1" . "${debian_chroot:+($debian_chroot)…") …)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string=: Wrong type argument in position 1 (expecting string): ("PS1" . "${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]${EXTRA}\\$ ")
user@popigai:~$
This is because the match pattern doesn’t expect `(vhash-assoc "PS1" actual)`
to return a pair.
* guix/scripts/environment.scm (validate-child-shell-environment): Change
match pattern to expect a pair.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/environment.scm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 8176de4a5e..821f20e2f2 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -517,7 +517,7 @@ environment~%"))) (unless warned? (match (vhash-assoc "PS1" actual) (#f #f) - (str + ((_ . str) (when (and (getenv "PS1") (string=? str (getenv "PS1"))) (warning (G_ "'PS1' is the same in sub-shell~%")) (display-hint (G_ "Consider setting a different prompt for |