GNU bug report logs - #51780
[PATCH] environment: Fix ‘--check’ with exported PS1 variable.

Previous Next

Package: guix-patches;

Reported by: Thiago Jung Bauermann <bauermann <at> kolabnow.com>

Date: Thu, 11 Nov 2021 23:57:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

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 51780 in the body.
You can then email your comments to 51780 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 guix-patches <at> gnu.org:
bug#51780; Package guix-patches. (Thu, 11 Nov 2021 23:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thiago Jung Bauermann <bauermann <at> kolabnow.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 11 Nov 2021 23:57:02 GMT) Full text and rfc822 format available.

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

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: guix-patches <at> gnu.org
Cc: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Subject: [PATCH] environment: Fix ‘--check’ with exported PS1 variable.
Date: Thu, 11 Nov 2021 20:46:48 -0300
If your .bashrc (unnecessarily) exports PS1 and you’re in a non-login
shell, Guix crashes:

--8<---------------cut here---------------start------------->8---
user <at> 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 <at> popigai:~$
--8<---------------cut here---------------end--------------->8---

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.
---
 guix/scripts/environment.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 8176de4a5e8c..821f20e2f223 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -517,7 +517,7 @@ (define-syntax-rule (warn exp ...)
     (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

base-commit: 893a31ec20f47b979c1be9fb8b942809228ba4c9




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 14 Nov 2021 22:17:02 GMT) Full text and rfc822 format available.

Notification sent to Thiago Jung Bauermann <bauermann <at> kolabnow.com>:
bug acknowledged by developer. (Sun, 14 Nov 2021 22:17:02 GMT) Full text and rfc822 format available.

Message #10 received at 51780-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Cc: 51780-done <at> debbugs.gnu.org
Subject: Re: bug#51780: [PATCH] environment: Fix ‘--check’ with exported PS1 variable.
Date: Sun, 14 Nov 2021 23:16:51 +0100
Hi,

Thiago Jung Bauermann <bauermann <at> kolabnow.com> skribis:

> If your .bashrc (unnecessarily) exports PS1 and you’re in a non-login
> shell, Guix crashes:
>
> user <at> 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 <at> 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.

Oops, good catch!  Applied, thanks.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#51780; Package guix-patches. (Tue, 16 Nov 2021 04:01:02 GMT) Full text and rfc822 format available.

Message #13 received at 51780-done <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 51780-done <at> debbugs.gnu.org
Subject: Re: bug#51780: [PATCH] environment: Fix
 ‘--check’ with exported PS1 variable.
Date: Tue, 16 Nov 2021 01:00:13 -0300
Hello Ludo,

Em domingo, 14 de novembro de 2021, às 19:16:51 -03, Ludovic Courtès 
escreveu:
> Oops, good catch!  Applied, thanks.

Thank you!

-- 
Thanks,
Thiago






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Dec 2021 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 95 days ago.

Previous Next


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