guix shell --check reports missing PKG_CONFIG_PATH on Debian bookworm

OpenSubmitted by Vagrant Cascadian.
Details
2 participants
  • Ludovic Courtès
  • Vagrant Cascadian
Owner
unassigned
Severity
normal
V
V
Vagrant Cascadian wrote on 28 Oct 21:08 +0200
(address . bug-guix@gnu.org)
87r1c5c6gk.fsf@ponder
This is a recently installed Debian bookworm system, initially using thepackage from debian experimental (guix 1.3.0-3, built with guile 3.0),and "guix pull" up to a recent guix master:
vagrant@vagranttdgxbookworm:~$ guix describeGeneration 7 Oct 28 2021 11:04:25 (current) guix 0e6470b repository URL: /home/vagrant/src/guix branch: master commit: 0e6470b47f00470c213fbf20bddc5bcf1e2f8e2a

Most things seem to work fine, but noticed an oddity with guix shell:
vagrant@vagranttdgxbookworm:~$ guix shell --pure --check --development guix guix git less
guix shell: checking the environment variables visible from shell'/bin/bash'...guix shell: warning: variable 'PKG_CONFIG_PATH' is missing from shellenvironmenthint: One or more environment variables have a different value in theshell than the one we set. This means that you may find yourselfrunning code in an environment different from the one you asked Guix toprepare.
This usually indicates that your shell startup files are unexpectedlymodifying those environment variables. For example, if youare using Bash, make sure that environment variables are set or modifiedin `~/.bash_profile' and _not_ in `~/.bashrc'. For moreinformation on Bash startup files, run:
info "(bash) Bash Startup Files"
Alternatively, you can avoid the problem by passing the `--container' or`-C' option. That will give you a fully isolatedenvironment running in a "container", immune to the issue describedabove.
vagrant@vagranttdgxbookworm:~$ guix shell --pure --development guix guix git less
vagrant@vagranttdgxbookworm:~$ echo $PKG_CONFIG_PATH/gnu/store/9vk59alg27y0cp1za91nfdjiy718cn1f-profile/lib/pkgconfig

So, --check seems to think the environment variable is missing butrunning without --check the variable is defined...
I don't see anything obviously relevent in /etc/profile/ or/etc/profile.d/guix.sh or /etc/profile.d/bash-completions.sh or~/.profile or ~/.bashrc ... just used the defaults that shipped inDebian.

live well, vagrant
-----BEGIN PGP SIGNATURE-----
iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCYXr1UgAKCRDcUY/If5cWquNBAP9rKrI7XSjsfxSFRJhJDY62J8PGtJRe7KJrqg7SaxDSQQEA6jpZL4/0xHFulrPBTdWmpRSK0MM/wY/oH34Z8On0JA4==/3/d-----END PGP SIGNATURE-----
L
L
Ludovic Courtès wrote on 29 Oct 21:06 +0200
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 51466@debbugs.gnu.org)
87o877y7kd.fsf@gnu.org
Hi!
Vagrant Cascadian <vagrant@debian.org> skribis:
Toggle quote (8 lines)> Most things seem to work fine, but noticed an oddity with guix shell:>> vagrant@vagranttdgxbookworm:~$ guix shell --pure --check --development guix guix git less>> guix shell: checking the environment variables visible from shell> '/bin/bash'...> guix shell: warning: variable 'PKG_CONFIG_PATH' is missing from shell
[...]
Toggle quote (5 lines)> vagrant@vagranttdgxbookworm:~$ guix shell --pure --development guix guix git less>> vagrant@vagranttdgxbookworm:~$ echo $PKG_CONFIG_PATH> /gnu/store/9vk59alg27y0cp1za91nfdjiy718cn1f-profile/lib/pkgconfig
Notice that it doesn’t complain about any of the other environmentvariables (there are 10 of them according to ‘guix shell -D guix--search-paths|wc -l’).
If you look at ‘child-shell-environment’ in (guix scripts environment),it runs this in the child shell:
env || /usr/bin/env || set; echo GUIX-CHECK-DONE; read x; exit
If the shell prints non-newline-terminated stuff before the output of‘env’, the first line of ‘env’ would be swallowed by the parser below.
Could you run:
strace -o log -s 500 guix shell --check -D guix
to see exactly what ‘guix shell’ reads?
If there’s nothing obvious, you know the story: we can always add ‘pk’calls in ‘child-shell-environment’. :-)
Thanks,Ludo’.
V
V
Vagrant Cascadian wrote on 30 Oct 08:35 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 51466@debbugs.gnu.org)
87k0hvggu1.fsf@yucca
On 2021-10-29, Ludovic Courtès wrote:
Toggle quote (35 lines)> Vagrant Cascadian <vagrant@debian.org> skribis:>>> Most things seem to work fine, but noticed an oddity with guix shell:>>>> vagrant@vagranttdgxbookworm:~$ guix shell --pure --check --development guix guix git less>>>> guix shell: checking the environment variables visible from shell>> '/bin/bash'...>> guix shell: warning: variable 'PKG_CONFIG_PATH' is missing from shell>> [...]>>> vagrant@vagranttdgxbookworm:~$ guix shell --pure --development guix guix git less>>>> vagrant@vagranttdgxbookworm:~$ echo $PKG_CONFIG_PATH>> /gnu/store/9vk59alg27y0cp1za91nfdjiy718cn1f-profile/lib/pkgconfig>> Notice that it doesn’t complain about any of the other environment> variables (there are 10 of them according to ‘guix shell -D guix> --search-paths|wc -l’).>> If you look at ‘child-shell-environment’ in (guix scripts environment),> it runs this in the child shell:>> env || /usr/bin/env || set; echo GUIX-CHECK-DONE; read x; exit>> If the shell prints non-newline-terminated stuff before the output of> ‘env’, the first line of ‘env’ would be swallowed by the parser below.>> Could you run:>> strace -o log -s 500 guix shell --check -D guix>> to see exactly what ‘guix shell’ reads?
That showed nothing obvious to me; the log it spits out is about 3MB(~320k compressed with zstd) I could attach if it is useful...
I did notice SHELL=/bin/bash, and tried an experiment:
$ SHELL=/gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash guix shell --check -D guix guix shell: checking the environment variables visible from shell '/gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash'... guix shell: All is good! The shell gets correct environment variables.
So, somehow the value of SHELL and/or the user's default shell istriggering the issue?

live well, vagrant
-----BEGIN PGP SIGNATURE-----
iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCYXznxgAKCRDcUY/If5cWqpfbAP9089bV8OFTOUgGd2qJo+nVRx8mnMlTow4V+p63ONpotwD+Itq3TH9KiVRbTQ90cqEOIb8M/QVRpyN0I2imW1+yXQ0==Dy+s-----END PGP SIGNATURE-----
L
L
Ludovic Courtès wrote on 30 Oct 16:21 +0200
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 51466@debbugs.gnu.org)
87lf2atwyi.fsf@gnu.org
Howdy!
Vagrant Cascadian <vagrant@debian.org> skribis:
Toggle quote (2 lines)> On 2021-10-29, Ludovic Courtès wrote:
[...]
Toggle quote (27 lines)>> If you look at ‘child-shell-environment’ in (guix scripts environment),>> it runs this in the child shell:>>>> env || /usr/bin/env || set; echo GUIX-CHECK-DONE; read x; exit>>>> If the shell prints non-newline-terminated stuff before the output of>> ‘env’, the first line of ‘env’ would be swallowed by the parser below.>>>> Could you run:>>>> strace -o log -s 500 guix shell --check -D guix>>>> to see exactly what ‘guix shell’ reads?>> That showed nothing obvious to me; the log it spits out is about 3MB> (~320k compressed with zstd) I could attach if it is useful...>> I did notice SHELL=/bin/bash, and tried an experiment:>> $ SHELL=/gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash guix shell --check -D guix> guix shell: checking the environment variables visible from shell> '/gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash'...> guix shell: All is good! The shell gets correct environment variables.>> So, somehow the value of SHELL and/or the user's default shell is> triggering the issue?
Yes, ‘--check’ runs $SHELL.
To make sure, could you try with the attached patch to see exactly whichvariables ‘guix shell’ “sees”, and whether it drops a line it shouldn’tdrop?
TIA,Ludo’.
Toggle diff (16 lines)diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scmindex cca0ad991b..7f3d3b9db8 100644--- a/guix/scripts/environment.scm+++ b/guix/scripts/environment.scm@@ -452,10 +452,10 @@ (define lines ;; but it also truncates values anyway, so don't try to support it. (let ((index (string-index line #\=))) (if index- (vhash-cons (string-take line index)+ (vhash-cons (pk 'variable line (string-take line index)) (string-drop line (+ 1 index)) table)- table)))+ (pk 'dropped line table)))) vlist-null lines))
L
L
Ludovic Courtès wrote on 15 Nov 15:43 +0100
control message for bug #51466
(address . control@debbugs.gnu.org)
8735nx5vjp.fsf@gnu.org
tags 51466 + moreinfoquit
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 51466@debbugs.gnu.org