[PATCH] gnu: mosh: Fix path to binaries.

  • Done
  • quality assurance status badge
Details
4 participants
  • Thiago Jung Bauermann
  • Leo Famulari
  • Ludovic Courtès
  • Michael Rohleder
Owner
unassigned
Submitted by
Michael Rohleder
Severity
normal
M
M
Michael Rohleder wrote on 29 Jan 2022 15:29
(address . guix-patches@gnu.org)(name . Michael Rohleder)(address . mike@rohleder.de)
20220129142950.26777-1-mike@rohleder.de
* 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.

gnu/packages/ssh.scm | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

Toggle diff (40 lines)
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
--
2.34.0
L
L
Leo Famulari wrote on 29 Jan 2022 22:02
(name . Michael Rohleder)(address . mike@rohleder.de)(address . 53623@debbugs.gnu.org)
YfWrVq9S+HZxY6rs@jasmine.lan
On Sat, Jan 29, 2022 at 03:29:50PM +0100, Michael Rohleder wrote:
Toggle quote (6 lines)
> * 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.
T
T
Thiago Jung Bauermann wrote on 29 Jan 2022 23:27
(address . 53623@debbugs.gnu.org)
4960193.dTnP56RHmP@popigai
Hello,

Em sábado, 29 de janeiro de 2022, às 18:02:14 -03, Leo Famulari escreveu:
Toggle quote (10 lines)
> 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.

--
Thanks,
Thiago
M
M
Michael Rohleder wrote on 30 Jan 2022 11:14
(name . Leo Famulari)(address . leo@famulari.name)(address . 53623@debbugs.gnu.org)
87h79lbkdc.fsf@rohleder.de
Leo Famulari <leo@famulari.name> writes:
Toggle quote (3 lines)
> 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 the eigth day, God started debugging
-----BEGIN PGP SIGNATURE-----

iQFFBAEBCAAvFiEEdV4t5dDVhcUueCgwfHr/vv7yyyUFAmH2ZR8RHG1pa2VAcm9o
bGVkZXIuZGUACgkQfHr/vv7yyyVmlQgAswkVI2PYotK8D+ANji9zKLT9Q68/g+9s
y4Px/ndNjF3cOUeyE52CXJccx6SakaIwIKIgtgoL56jP39rGhJnEqYY4SWBM0JoD
LiaPhCfI+52wTzXQ3LN9Pj6yS7V1sfaP0dPRfSo9siPns4CK0UvMpOso9kijLSKz
ipeYCwTlfhJL0yDdYaAChzSTD4iodHpNYckGKBGr/P4Bov8/uSpW5nXWzX6UvPrk
l8X/BMa5nDmVj2m8LocVfOYKfsn6cONHhlF9enahyjMS+FoaAg4/07ToUVcqCQms
Ytak7tmQIQX0YjyqFYsqKx/MbefOMVBs8rcIy8kJKxqunQ7horQNxA==
=uCS2
-----END PGP SIGNATURE-----

L
L
Leo Famulari wrote on 30 Jan 2022 19:35
(name . Michael Rohleder)(address . mike@rohleder.de)(address . 53623@debbugs.gnu.org)
YfbaYEVarzm9gsdj@jasmine.lan
On Sun, Jan 30, 2022 at 11:14:55AM +0100, Michael Rohleder wrote:
Toggle quote (11 lines)
> 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`?

Toggle quote (4 lines)
> 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.
M
M
Michael Rohleder wrote on 30 Jan 2022 19:44
(name . Leo Famulari)(address . leo@famulari.name)(address . 53623@debbugs.gnu.org)
87k0ehawrm.fsf@rohleder.de
Leo Famulari <leo@famulari.name> writes:
Toggle quote (3 lines)
> 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.

--
Old programmers never die, they just become managers.
-----BEGIN PGP SIGNATURE-----

iQFFBAEBCAAvFiEEdV4t5dDVhcUueCgwfHr/vv7yyyUFAmH23J0RHG1pa2VAcm9o
bGVkZXIuZGUACgkQfHr/vv7yyyUBfggAqiTpIs1DHDJlkGprWkOJDLlcXX0m3cqS
F928LkoiiKOBpqMxYSLL/mdzO+Imofvg+amz7U54ySsOYKlqHvFthXeAYvaVgKr+
+p6BrGAXHZB03mOzl9eeWWjcDMeUxhjXNVQ2iyqWWGqmXg4ecn4+L3kYMj8Sxayb
GqiiJ+KbLIqofLDxIQ7xucTjxuP2eVTnWoYwQBtxWqRjHhORg7HnYppx7hRnMqXx
Ec/P0j+qT2QPGt6YVFE1ljQTQR51jgpvV+scYWmxc7xQdGMS1bQt/YAxn+CDFvke
WXPkC9TQ/JMp3XcvtJ0DlbDdt4Nh3c/bh+ekooN8mQJf98foPbyBfQ==
=ghpx
-----END PGP SIGNATURE-----

L
L
Leo Famulari wrote on 30 Jan 2022 20:10
(name . Michael Rohleder)(address . mike@rohleder.de)(address . 53623@debbugs.gnu.org)
Yfbiv98jmOC9mo2y@jasmine.lan
On Sun, Jan 30, 2022 at 07:44:45PM +0100, Michael Rohleder wrote:
Toggle quote (7 lines)
> 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:

T
T
Thiago Jung Bauermann wrote on 30 Jan 2022 23:32
(address . 53623@debbugs.gnu.org)
7617642.h6mQfoo1ea@popigai
Hello,

Em domingo, 30 de janeiro de 2022, às 16:10:55 -03, Leo Famulari escreveu:
Toggle quote (22 lines)
> 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.

--
Thanks,
Thiago
L
M
M
Michael Rohleder wrote on 7 Mar 2022 09:54
(name . Ludovic Courtès)(address . ludo@gnu.org)
87sfruuopz.fsf@rohleder.de
Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (2 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQFFBAEBCAAvFiEEdV4t5dDVhcUueCgwfHr/vv7yyyUFAmIlyFkRHG1pa2VAcm9o
bGVkZXIuZGUACgkQfHr/vv7yyyXtLQf/QN2wbsUvgvPI1CE26vQUoqByji3acOK2
wtFW4j64jJdwvUkYMJz+leowjtPRcslAmONUcpy+WhwuLLLNad9YFKfXEe73u+GO
V6wiAh63MrQlRg0pEB1HAvRjWEE+kJ51QobYTiLes6jufftMregsnQ9SiyTIydzY
VNs7b2Qchq4ZtnP77yOFC/5EEuIQEQOA9Xzbsu6FCbnUbqpRnCRcTcxvFh8e7WCk
cHn8LUxiZqvk12/AiBKm/mG4f+CP194wQyIPs3HgAdQcpdoU+F85KeI9baYBQhnJ
g1t2D4XO1UwkajqaAhCLYQtvgya2BpdvXsuvwqvDSutVmCJykjfg6w==
=hOhm
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 7 Mar 2022 21:23
(name . Michael Rohleder)(address . mike@rohleder.de)
8735jt1pi3.fsf_-_@gnu.org
Hi Michael,

Michael Rohleder <mike@rohleder.de> skribis:

Toggle quote (6 lines)
> 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’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 53623@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 53623
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch