From: Saku Laesvuori via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Malte Frank Gerdes <malte.f.gerdes@gmail.com>
Cc: 66168@debbugs.gnu.org
Subject: bug#66168: zsh home service breaks guix shell via ssh
Date: Mon, 25 Sep 2023 17:56:34 +0300 [thread overview]
Message-ID: <vnlwmxbvzg5gofbvff2tsaefgxx4edsqwzs7vnc3mzqs67fupz@dqbhrbdhs6sk> (raw)
In-Reply-To: <86cyy75rg1.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2252 bytes --]
> > ```
> > $ ssh localhost
> > $ guix shell gnuplot
> > $ gnuplot
> > zsh: command not found: gnuplot
> > ```
> >
> > However (still within the ssh session)
> >
> > ```
> > $ guix shell gnuplot -- gnuplot
> > [gnuplot opens as expected]
> > ```
> >
> > and weirdly enough
> >
> > ```
> > $ guix shell --check gnuplot
> > guix shell: checking the environment variables visible from shell '/gnu/store/i4rj0banq044423if5xwb3df723g14r9-zsh-5.9/bin/zsh'...
> > guix shell: All is good! The shell gets correct environment variables.
> > $ gnuplot
> > zsh: command not found: gnuplot
> > ```
> >
> > I don't really know what is happening here. Why does it work when
> > running the command directly and why does `guix shell --check` claim
> > that everything is correct when clearly something is wrong? If I
> > understand correctly `.zshenv` should be sourced in all these cases but
> > for some reason the problems only occur in some of them.
> >
> > Any ideas?
>
> My guess would be that sourcing /etc/profile should only happen once,
> but the SSH_CLIENT variable is inherited to the child shell which
> evaluates zshenv which in turn sources /etc/profile because SSH_CLIENT
> has non-zero length. So /etc/profile is sourced twice.
>
> This is just a wild guess though.
Seems to be about right. I had just assumed that guix shell would run
the command in a new shell (causing .zshenv to be sourced in all those
cases) but apparently it just calls the command directly. I haven't seen
any problems with sourcing /etc/profile multiple times because it
reloads both system and user profiles, but obviously it doesn't know
about guix shell profiles.
It seems that the default bash configuration only sources /etc/profile
if $SSH_CLIENT is non-empty and bash is used non-interactively.
Something similar could probably be done with zsh, but I would expect it
to still have this issue in certain situation. For example, I think
running a script like this
```
$ ssh host -- guix shell gnuplot <<EOF
...
EOF
```
would probably still fail.
I can't really think of any other possible solution than having an
environment variable that is set by /etc/profile and that makes sourcing
it a no-op.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2023-09-25 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-23 10:19 bug#66168: zsh home service breaks guix shell via ssh Malte Frank Gerdes
2023-09-24 15:27 ` Saku Laesvuori via Bug reports for GNU Guix
2023-09-24 18:48 ` Malte Frank Gerdes
2023-09-25 14:56 ` Saku Laesvuori via Bug reports for GNU Guix [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vnlwmxbvzg5gofbvff2tsaefgxx4edsqwzs7vnc3mzqs67fupz@dqbhrbdhs6sk \
--to=bug-guix@gnu.org \
--cc=66168@debbugs.gnu.org \
--cc=malte.f.gerdes@gmail.com \
--cc=saku@laesvuori.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.