all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 29.1: tramp: use $SHELL environment variable to start remote shell?
@ 2024-02-23 14:53 Giovanni Biscuolo
  2024-02-23 18:31 ` Giovanni Biscuolo
  0 siblings, 1 reply; 2+ messages in thread
From: Giovanni Biscuolo @ 2024-02-23 14:53 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 2924 bytes --]

Hello,

please is it possible to start a remote shell (and vterm) using the
program defined in the $SHELL env variable on the remote host?

Alternatively, is there a way to automatically source a remote profile
(e.g. .bash_profile) in the remote shell?

Short story long (sorry for the long details)...

I have this Emacs and TRAMP versions:

--8<---------------cut here---------------start------------->8---
(emacs-version)
"GNU Emacs 29.1 (build 1, x86_64-unknown-linux-gnu, cairo version 1.16.0)"

(tramp-version nil)
"2.6.2.0"
--8<---------------cut here---------------end--------------->8---

Installed emacs-vterm version: 0.0.2-1.c3a3a23

If I open a remote directory in dired with TRAMP and then connect to a
remote host with "M-x shell" or "M-x vterm", the default shell is
/bin/sh

I can later start my preferred shell with "$SHELL -l" so my shell
profile (e.g. .bash_profile) is sourced and all is working as expected
[1]

I need my remote profile to be loaded because all hosts I manage have
Guix [2] installed and all needed environment variables are set by the
user profile; here is an example of a "M-x shell" remote connection to a
guix host (foreign distro), the same holds for "M-x eshell":

--8<---------------cut here---------------start------------->8---

/ssh:local.biscuolo.anemone:/localhome/g/ #$ guix describe
  guix 3676e31
    repository URL: https://git.savannah.gnu.org/git/guix.git
    commit: 3676e312aaf1ce10ed1d7844e871b54e04624098
/ssh:local.biscuolo.anemone:/localhome/g/ #$ $SHELL -l
(anemone)g@anemone:~$ guix describe
Generation 9	Apr 21 2021 09:23:33	(current)
  guix 13c4a37
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 13c4a377f5a2e1240790679f3d5643385b6d7635

--8<---------------cut here---------------end--------------->8---
(as you can see, without proper environment guix is not able to run as
it should)

I know that I can customize the remote shell to use by:

1. use "C-u M-x shell" and specify the remote shell to use [3]

2. use connection related information [4] to customize "remote-shell"
per-connection (via regexp)

but 1. does not vork for vterm and 2. is too complicated for this use
case, IMO.

Ideally I would like both "M-x shell" and "M-x vterm" to just do "the
right thing" and start a remote shell using the remote $SHELL
environment variable.

Any hint please?

Happy hacking, Gio'


[1] I mean, is working in the same way I get when connecting with any
other terminal emulator

[2] some on foreign distro, other on Guix System

[3] /bin/bash on foreign distros, /run/current-system/profile/bin/bash
on Guix System

[4] https://www.gnu.org/software/emacs/manual/html_node/tramp/Predefined-connection-information.html



P.S.: yes, still not using eshell as I should! :-(

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 29.1: tramp: use $SHELL environment variable to start remote shell?
  2024-02-23 14:53 29.1: tramp: use $SHELL environment variable to start remote shell? Giovanni Biscuolo
@ 2024-02-23 18:31 ` Giovanni Biscuolo
  0 siblings, 0 replies; 2+ messages in thread
From: Giovanni Biscuolo @ 2024-02-23 18:31 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

Giovanni Biscuolo <g@xelera.eu> writes:

[...]

> I need my remote profile to be loaded because all hosts I manage have
> Guix [2] installed and all needed environment variables are set by the
> user profile; here is an example of a "M-x shell" remote connection to a
> guix host (foreign distro), the same holds for "M-x eshell":
>
> --8<---------------cut here---------------start------------->8---
>
> /ssh:local.biscuolo.anemone:/localhome/g/ #$ guix describe
>   guix 3676e31
>     repository URL: https://git.savannah.gnu.org/git/guix.git
>     commit: 3676e312aaf1ce10ed1d7844e871b54e04624098
> /ssh:local.biscuolo.anemone:/localhome/g/ #$ $SHELL -l
> (anemone)g@anemone:~$ guix describe
> Generation 9	Apr 21 2021 09:23:33	(current)
>   guix 13c4a37
>     repository URL: https://git.savannah.gnu.org/git/guix.git
>     branch: master
>     commit: 13c4a377f5a2e1240790679f3d5643385b6d7635
>
> --8<---------------cut here---------------end--------------->8---
> (as you can see, without proper environment guix is not able to run as
> it should)

Please forgive me for the noise: the problem is in the environment of
(one of) my remote user!

I tested again with other users on other hosts and the environment
variables of my profile are correctly set.

Anyway, the shell I get when connecting is still not fully functional,
for example autocompletion does not work (write a substring and then
TAB) and also up and down arrow keys do not work (echoes escape
sequances instead of showing the shell history)

Am I still doing something wrong with my environment?

Ouch!  Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-23 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 14:53 29.1: tramp: use $SHELL environment variable to start remote shell? Giovanni Biscuolo
2024-02-23 18:31 ` Giovanni Biscuolo

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.