bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53355: guix shell --check: confusing error message


From: Chris Marusich
Subject: bug#53355: guix shell --check: confusing error message
Date: Mon, 24 Jan 2022 16:55:13 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Ludo,

Thank you for the response!

Ludovic Courtès <ludo@gnu.org> writes:

> What’s confusing is that ‘--check’ does the same job whether or not
> ‘--container’ is passed: it checks the behavior of your shell *outside*
> a container.
>
> I think ‘--check’ should just do nothing when ‘--container’ is used,
> possibly emitting a warning saying it’s not doing anything (patch
> below).
>
> Now, the diagnostic is hopefully correct if you use, say, ‘--pure’
> instead of ‘--container’.  Could you check whether this is the case?

That sounds reasonable.  I tested your patch.  It now correctly emits a
warning when both --container and --check are provided.  However, I now
see that the issue occurs even when --container is omitted.  So it seems
like something else might be going on.

Below, I'll provide details of what I did to test your patch.

In one test, I committed your change locally and did "guix pull" to
install the patched Guix into ~/tmpguixprofile.  I then tried using it:

--8<---------------cut here---------------start------------->8---
[0] marusich@suzaku:~/guix-master
$ env -i bash
[0] marusich@suzaku:/home/marusich/guix-master
$ activate-profile ~/tmpguixprofile
[0] marusich@suzaku:/home/marusich/guix-master
$ which guix
/home/marusich/tmpguixprofile/bin/guix
--8<---------------cut here---------------end--------------->8---

First, I tried without --pure or --container.  Below, you can see that
it claims LIBRARY_PATH is missing, but it does not seem to be missing:

--8<---------------cut here---------------start------------->8---
[0] marusich@suzaku:/home/marusich/guix-master
$ guix shell --check -D guix
guix shell: checking the environment variables visible from shell '/bin/sh'...
guix shell: warning: variable 'LIBRARY_PATH' is missing from shell environment
hint: One or more environment variables have a different value in the shell than
the one we set.  This means that you may find yourself running code in an
environment different from the one you asked Guix to prepare.

This usually indicates that your shell startup files are unexpectedly
modifying those environment variables.  For example, if you are using Bash,
make sure that environment variables are set or modified in
`~/.bash_profile' and _not_ in `~/.bashrc'.  For more information 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 isolated environment running in a
"container", immune to the issue described above.

[1] marusich@suzaku:/home/marusich/guix-master
$ env | grep LIBRARY_PATH
[1] marusich@suzaku:/home/marusich/guix-master
$ guix shell -D guix
[0] \u@\H:\w\n$ env | grep LIBRARY_PATH
LIBRARY_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib
--8<---------------cut here---------------end--------------->8---

Next, I tried with --container - you can see it works as intended:

--8<---------------cut here---------------start------------->8---
[0] marusich@suzaku:/home/marusich/guix-master
$ guix shell --container --check -D guix
guix shell: warning: '--check' is unnecessary when using '--container'; doing 
nothing
--8<---------------cut here---------------end--------------->8---

Next, I tried with --pure and --check - once again, it claims
LIBRARY_PATH is missing, even though it does not seem to be missing:

--8<---------------cut here---------------start------------->8---
[0] marusich@suzaku:/home/marusich/guix-master
$ guix shell --pure --check -D guix
guix shell: checking the environment variables visible from shell '/bin/sh'...
guix shell: warning: variable 'LIBRARY_PATH' is missing from shell environment
hint: One or more environment variables have a different value in the shell than
the one we set.  This means that you may find yourself running code in an
environment different from the one you asked Guix to prepare.

This usually indicates that your shell startup files are unexpectedly
modifying those environment variables.  For example, if you are using Bash,
make sure that environment variables are set or modified in
`~/.bash_profile' and _not_ in `~/.bashrc'.  For more information 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 isolated environment running in a
"container", immune to the issue described above.

[1] marusich@suzaku:/home/marusich/guix-master
$ env | grep LIBRARY_PATH
[1] marusich@suzaku:/home/marusich/guix-master
$ guix shell --pure -D guix
$ env | grep LIBRARY_PATH
LIBRARY_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib
--8<---------------cut here---------------end--------------->8---

A similar error message occurs if I try the same steps from a checkout
using pre-inst-env.  However, in that case the offending environment
variable is different (PKG_CONFIG_PATH in this case):

--8<---------------cut here---------------start------------->8---
[0] marusich@suzaku:~/guix-master
$ guix environment guix
[0] [env] marusich@suzaku:~/guix-master
$ ./pre-inst-env guix shell --check -D guix -- bash -c 'echo in env, 
PKG_CONFIG_PATH="$PKG_CONFIG_PATH"'
guix shell: checking the environment variables visible from shell '/bin/bash'...
guix shell: warning: variable 'PKG_CONFIG_PATH' is missing from shell 
environment
hint: One or more environment variables have a different value in the shell than
the one we set.  This means that you may find yourself running code in an
environment different from the one you asked Guix to prepare.

This usually indicates that your shell startup files are unexpectedly
modifying those environment variables.  For example, if you are using Bash,
make sure that environment variables are set or modified in
`~/.bash_profile' and _not_ in `~/.bashrc'.  For more information 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 isolated environment running in a
"container", immune to the issue described above.

[1] [env] marusich@suzaku:~/guix-master
$ ./pre-inst-env guix shell --check --pure -D guix -- bash -c 'echo in env, 
PKG_CONFIG_PATH="$PKG_CONFIG_PATH"'
guix shell: checking the environment variables visible from shell '/bin/bash'...
guix shell: warning: variable 'PKG_CONFIG_PATH' is missing from shell 
environment
hint: One or more environment variables have a different value in the shell than
the one we set.  This means that you may find yourself running code in an
environment different from the one you asked Guix to prepare.

This usually indicates that your shell startup files are unexpectedly
modifying those environment variables.  For example, if you are using Bash,
make sure that environment variables are set or modified in
`~/.bash_profile' and _not_ in `~/.bashrc'.  For more information 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 isolated environment running in a
"container", immune to the issue described above.

[1] [env] marusich@suzaku:~/guix-master
$ ./pre-inst-env guix shell --check --container -D guix -- bash -c 'echo in 
env, PKG_CONFIG_PATH="$PKG_CONFIG_PATH"'
guix shell: warning: '--check' is unnecessary when using '--container'; doing 
nothing
in env, 
PKG_CONFIG_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib/pkgconfig
[0] [env] marusich@suzaku:~/guix-master
$ ./pre-inst-env guix shell -D guix -- bash -c 'echo in env, 
PKG_CONFIG_PATH="$PKG_CONFIG_PATH"'
in env, 
PKG_CONFIG_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib/pkgconfig:/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib/pkgconfig
[0] [env] marusich@suzaku:~/guix-master
$ ./pre-inst-env guix shell --pure -D guix -- bash -c 'echo in env, 
PKG_CONFIG_PATH="$PKG_CONFIG_PATH"'
in env, 
PKG_CONFIG_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib/pkgconfig
[0] [env] marusich@suzaku:~/guix-master
$ ./pre-inst-env guix shell --container -D guix -- bash -c 'echo in env, 
PKG_CONFIG_PATH="$PKG_CONFIG_PATH"'
in env, 
PKG_CONFIG_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib/pkgconfig
[0] [env] marusich@suzaku:~/guix-master
$ echo out of env, PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
out of env, 
PKG_CONFIG_PATH=/gnu/store/hvcq6yjfjjc7060pq09zm1rj02mivg4h-profile/lib/pkgconfig
[0] [env] marusich@suzaku:~/guix-master
$
--8<---------------cut here---------------end--------------->8---

It seems this issue happens regardless of whether I use pre-inst-env or
run Guix from a "guix pull" installation.

-- 
Chris

PGP: https://savannah.gnu.org/people/viewgpg.php?user_id=106836

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]