Subject: Re: bug#27386: offloading documentation and env

From: ng0 <[email-masked]>
Date: Wed, 28 Jun 2017 11:45:30 +0000

Ludovic Courtès transcribed 1.8K bytes:
> ng0 <[email-masked]> skribis:
> 
> > Ludovic Courtès transcribed 2.2K bytes:
> >> ng0 <[email-masked]> skribis:
> >> 
> >> > Ludovic Courtès transcribed 2.8K bytes:
> 
> [...]
> 
> >> The problem here is that
> >> /run/current-system/profile/share/guile/site/2.2, which is where the
> >> Guix modules are on GuixSD as I wrote above, is missing from the search
> >> path.
> >> 
> >> The session started when you run “ssh shadownet env” does not spawn a
> >> login shell; thus ~/.profile and similar are *not* sourced.  I’m using
> >
> > I was aware of this, but I thought we had (guix) available nevertheless
> > and I was just pushing the wrong buttons.
> >
> >> Bash, so on my accounts, I have this in .bashrc (‘.bashrc’ is for
> >> non-login shells):
> >> 
> >> --8<---------------cut here---------------start------------->8---
> >> if [ -n "$SSH_CLIENT" -a -z "`type -P cat`" ]
> >> then
> >>     # We are being invoked from a non-interactive SSH session
> >>     # (as in "ssh host command") but 'cat' cannot be found
> >>     # in $PATH.  Source /etc/profile so we get $PATH and other
> >>     # essential variables.
> >>     source /etc/profile
> >> fi
> >> --8<---------------cut here---------------end--------------->8---
> >> 
> >> That way, “ssh HOST COMMAND” effectively gets the same environment as a
> >> login shell.
> >
> > I use the same on this computer, but at the end of it I source some
> > files, among them ~/.guix-profile/etc/profile
> >
> > I would guess that sourcing ~/.guix-profile/etc/profile gets into
> > the way and that moving this to .bash_profile could fix the issue.
> >
> > What do you think?
> 
> ~/.guix-profile/etc/profile won't add /run/current-system/… to the
> search path.  You really need to source /etc/profile, which in turn will
> source ~/.guix-profile/etc/profile (on GuixSD).
> 
> HTH,
> Ludo’.

I think the method as described never really worked.

When I do as you (and the manual) suggested, I no longer
have any results for ssh host env | grep "GUILE_".

When I extend it like this it works. I include the full
paste to show that previously I had the sourcing of /etc/profile
in it:

user@shadownet ~$ cat .bashrc
# Bash initialization for interactive non-login shells and
# for remote shells (info "(bash) Bash Startup Files").

# Export 'SHELL' to child processes.  Programs such as 'screen'
# honor it and otherwise use /bin/sh.
export SHELL

if [ -n "$SSH_CLIENT" -a -z "`type -P cat`" ]
then
    # We are being invoked from a non-interactive SSH session
    # (as in "ssh host command") but 'cat' cannot be found
    # in $PATH.  Source /etc/profile so we get $PATH and other
    # essential variables.
    source /etc/profile
fi

# Adjust the prompt depending on whether we're in 'guix environment'.
if [ -n "$GUIX_ENVIRONMENT" ]
then
    PS1='\u@\h \w [env]\$ '
else
    PS1='\u@\h \w\$ '
fi
source ~/.guix-profile/etc/profile
alias ls='ls -p --color'
alias ll='ls -l'
GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}:/run/current-system/profile/lib/guile/2.2/site-ccache:/run/current-system/profile/share/guile/site/2.2"
GUILE_LOAD_PATH="${GUILE_LOAD_PATH}:/run/current-system/profile/share/guile/site/2.2"

I suggest that we fix the offloading documentation.
If questions are asked (I'm not the first) there are obviously problems
with how it is written.
If no one else takes on this, I will.
-- 
ng0
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://n0is.noblogs.org/my-keys
infotropique: https://www.infotropique.org