Message ID | 20220129142950.26777-1-mike@rohleder.de |
---|---|
State | Accepted |
Headers | show |
Series | [bug#53623] gnu: mosh: Fix path to binaries. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
On Sat, Jan 29, 2022 at 03:29:50PM +0100, Michael Rohleder wrote: > * gnu/packages/ssh.scm (mosh)[arguments]: Add substitution for mosh-server and > -client. Remove unneeded 'wrap phase. > --- > For some reason setting $PATH in 'wrap phase doesn't work anymore, the perl > script doesn't find it's binaries, so I substitute them there. Can you clarify the situation where it doesn't work? I'm using mosh as a server on Guix System and it's working for me.
Hello, Em sábado, 29 de janeiro de 2022, às 18:02:14 -03, Leo Famulari escreveu: > On Sat, Jan 29, 2022 at 03:29:50PM +0100, Michael Rohleder wrote: > > * gnu/packages/ssh.scm (mosh)[arguments]: Add substitution for > > mosh-server and -client. Remove unneeded 'wrap phase. > > --- > > For some reason setting $PATH in 'wrap phase doesn't work anymore, the > > perl script doesn't find it's binaries, so I substitute them there. > > Can you clarify the situation where it doesn't work? I'm using mosh as a > server on Guix System and it's working for me. I’m also using it both as a client and a server and it’s working fine for me. Both the client and the server are on foreign distros.
Leo Famulari <leo@famulari.name> writes: > Can you clarify the situation where it doesn't work? I'm using mosh as a > server on Guix System and it's working for me. Interesting. On my guix system it currently does this: ~$ mosh localhost bash: line 1: mosh-server: command not found Connection to localhost closed. /gnu/store/8xfhfr75svf6lw3fl4pnj47f31hz04lr-mosh-1.3.2/bin/.mosh-real: Did not find mosh server startup message. (Have you installed mosh on your server?) It's the same for remote guix systems. Well, atleast the patch would save spawning a subshell ;)
On Sun, Jan 30, 2022 at 11:14:55AM +0100, Michael Rohleder wrote: > Leo Famulari <leo@famulari.name> writes: > > Can you clarify the situation where it doesn't work? I'm using mosh as a > > server on Guix System and it's working for me. > > Interesting. On my guix system it currently does this: > > ~$ mosh localhost > bash: line 1: mosh-server: command not found > Connection to localhost closed. > /gnu/store/8xfhfr75svf6lw3fl4pnj47f31hz04lr-mosh-1.3.2/bin/.mosh-real: Did not find mosh server startup message. (Have you installed mosh on your server?) I wonder, did you install mosh via config.scm? Or with `guix install mosh`? > It's the same for remote guix systems. > > Well, atleast the patch would save spawning a subshell ;) True, I think there's no harm with your patch.
Leo Famulari <leo@famulari.name> writes: > I wonder, did you install mosh via config.scm? Or with `guix install > mosh`? mosh is installed in the user profile via `guix install`. perl is installed via config.scm.
On Sun, Jan 30, 2022 at 07:44:45PM +0100, Michael Rohleder wrote: > Leo Famulari <leo@famulari.name> writes: > > I wonder, did you install mosh via config.scm? Or with `guix install > > mosh`? > > mosh is installed in the user profile via `guix install`. > perl is installed via config.scm. Ah. I had to install mosh via config.scm, probably to work around this issue. The environment created when logging in over SSH to use a non-interactive shell (such as for starting mosh) is not a complete environment and doesn't really work for packages installed with Guix. We arranged so that system-level packages would work correctly in this enviroment, but it's not trivial to design a solution for user-level packages: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/shadow.scm?id=43dd34c7777a212c99a97da7a2c237158faa9a1b#n135
Hello, Em domingo, 30 de janeiro de 2022, às 16:10:55 -03, Leo Famulari escreveu: > On Sun, Jan 30, 2022 at 07:44:45PM +0100, Michael Rohleder wrote: > > Leo Famulari <leo@famulari.name> writes: > > > I wonder, did you install mosh via config.scm? Or with `guix install > > > mosh`? > > > > mosh is installed in the user profile via `guix install`. > > perl is installed via config.scm. > > Ah. I had to install mosh via config.scm, probably to work around this > issue. > > The environment created when logging in over SSH to use a > non-interactive shell (such as for starting mosh) is not a complete > environment and doesn't really work for packages installed with Guix. > > We arranged so that system-level packages would work correctly in this > enviroment, but it's not trivial to design a solution for user-level > packages: > > https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/shadow.scm?id= > 43dd34c7777a212c99a97da7a2c237158faa9a1b#n135 Ah, right. I ran into that when mosh’ing into the remote machine. This is actually a bash limitation (or even bug, I’d argue), because it doesn’t have an initialization file to set the environment for both interactive and non-interactive shells. zsh has ~/.zshenv, which is always read and is where I source /etc/profile.d/*.sh (including guix.sh). So the solution was simply to change the login shell from bash to zsh.
Hi there! So what’s the status of this patch? :-) https://issues.guix.gnu.org/53623 TIA, Ludo’.
Hi Ludo,
Ludovic Courtès <ludo@gnu.org> writes:
> So what’s the status of this patch? :-)
I can confirm that mosh(-server) works in a system profile.
This patch would only save us a bash exec, not sure if it's worth it.
Hi Michael, Michael Rohleder <mike@rohleder.de> skribis: > Ludovic Courtès <ludo@gnu.org> writes: >> So what’s the status of this patch? :-) > > I can confirm that mosh(-server) works in a system profile. > This patch would only save us a bash exec, not sure if it's worth it. Alright, closing, but feel free to reopen if you change your mind. Thanks, Ludo’.
diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm index 4dd8bb6d96..c296029fc0 100644 --- a/gnu/packages/ssh.scm +++ b/gnu/packages/ssh.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re> +;;; Copyright © 2022 Michael Rohleder <mike@rohleder.de> ;;; ;;; This file is part of GNU Guix. ;;; @@ -478,19 +479,15 @@ (define-public mosh '(#:phases (modify-phases %standard-phases (add-after 'unpack 'patch-FHS-file-names - (lambda _ - (substitute* "scripts/mosh.pl" - (("/bin/sh") - (which "sh"))) - #t)) - (add-after 'install 'wrap (lambda* (#:key outputs #:allow-other-keys) - ;; Make sure 'mosh' can find 'mosh-client' and - ;; 'mosh-server'. (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin"))) - (wrap-program (string-append bin "/mosh") - `("PATH" ":" prefix (,bin))))))))) + (substitute* "scripts/mosh.pl" + (("/bin/sh") (which "sh")) + (("\\$server = 'mosh-server'") + (string-append "$server = '" bin "/mosh-server'")) + (("\\$client = 'mosh-client'") + (string-append "$client = '" bin "/mosh-client'"))))))))) (native-inputs (list pkg-config)) (inputs