GNU bug report logs - #53623
[PATCH] gnu: mosh: Fix path to binaries.

Previous Next

Package: guix-patches;

Reported by: Michael Rohleder <mike <at> rohleder.de>

Date: Sat, 29 Jan 2022 14:31:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53623 in the body.
You can then email your comments to 53623 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sat, 29 Jan 2022 14:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Rohleder <mike <at> rohleder.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 29 Jan 2022 14:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Rohleder <mike <at> rohleder.de>
To: guix-patches <at> gnu.org
Cc: Michael Rohleder <mike <at> rohleder.de>
Subject: [PATCH] gnu: mosh: Fix path to binaries.
Date: Sat, 29 Jan 2022 15:29:50 +0100
* 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(-)

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 <at> gmail.com>
 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
+;;; Copyright © 2022 Michael Rohleder <mike <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sat, 29 Jan 2022 21:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Michael Rohleder <mike <at> rohleder.de>
Cc: 53623 <at> debbugs.gnu.org
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sat, 29 Jan 2022 16:02:14 -0500
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.




Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sat, 29 Jan 2022 22:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: 53623 <at> debbugs.gnu.org
Cc: Michael Rohleder <mike <at> rohleder.de>, Leo Famulari <leo <at> famulari.name>
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sat, 29 Jan 2022 19:27:58 -0300
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.

-- 
Thanks,
Thiago






Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sun, 30 Jan 2022 10:17:02 GMT) Full text and rfc822 format available.

Message #14 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Michael Rohleder <mike <at> rohleder.de>
To: Leo Famulari <leo <at> famulari.name>
Cc: 53623 <at> debbugs.gnu.org
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sun, 30 Jan 2022 11:14:55 +0100
[Message part 1 (text/plain, inline)]
Leo Famulari <leo <at> 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 the eigth day, God started debugging
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sun, 30 Jan 2022 18:36:02 GMT) Full text and rfc822 format available.

Message #17 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Michael Rohleder <mike <at> rohleder.de>
Cc: 53623 <at> debbugs.gnu.org
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sun, 30 Jan 2022 13:35:12 -0500
On Sun, Jan 30, 2022 at 11:14:55AM +0100, Michael Rohleder wrote:
> Leo Famulari <leo <at> 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.




Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sun, 30 Jan 2022 18:46:01 GMT) Full text and rfc822 format available.

Message #20 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Michael Rohleder <mike <at> rohleder.de>
To: Leo Famulari <leo <at> famulari.name>
Cc: 53623 <at> debbugs.gnu.org
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sun, 30 Jan 2022 19:44:45 +0100
[Message part 1 (text/plain, inline)]
Leo Famulari <leo <at> 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.

-- 
Old programmers never die, they just become managers.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sun, 30 Jan 2022 19:12:02 GMT) Full text and rfc822 format available.

Message #23 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Michael Rohleder <mike <at> rohleder.de>
Cc: 53623 <at> debbugs.gnu.org
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sun, 30 Jan 2022 14:10:55 -0500
On Sun, Jan 30, 2022 at 07:44:45PM +0100, Michael Rohleder wrote:
> Leo Famulari <leo <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sun, 30 Jan 2022 22:33:01 GMT) Full text and rfc822 format available.

Message #26 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
To: 53623 <at> debbugs.gnu.org
Cc: Michael Rohleder <mike <at> rohleder.de>, Leo Famulari <leo <at> famulari.name>
Subject: Re: [bug#53623] [PATCH] gnu: mosh: Fix path to binaries.
Date: Sun, 30 Jan 2022 19:32:24 -0300
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 <at> 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






Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Sun, 06 Mar 2022 21:40:02 GMT) Full text and rfc822 format available.

Message #29 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 53623 <at> debbugs.gnu.org,  Michael Rohleder <mike <at> rohleder.de>,  Leo
 Famulari <leo <at> famulari.name>, Thiago Jung Bauermann
 <bauermann <at> kolabnow.com>
Subject: Re: bug#53623: [PATCH] gnu: mosh: Fix path to binaries.
Date: Sun, 06 Mar 2022 22:39:47 +0100
Hi there!

So what’s the status of this patch?  :-)

  https://issues.guix.gnu.org/53623

TIA,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#53623; Package guix-patches. (Mon, 07 Mar 2022 08:56:01 GMT) Full text and rfc822 format available.

Message #32 received at 53623 <at> debbugs.gnu.org (full text, mbox):

From: Michael Rohleder <mike <at> rohleder.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 53623 <at> debbugs.gnu.org, Thiago Jung Bauermann <bauermann <at> kolabnow.com>,
 Leo Famulari <leo <at> famulari.name>
Subject: Re: bug#53623: [PATCH] gnu: mosh: Fix path to binaries.
Date: Mon, 07 Mar 2022 09:54:48 +0100
[Message part 1 (text/plain, inline)]
Hi Ludo,

Ludovic Courtès <ludo <at> 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.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 07 Mar 2022 20:24:01 GMT) Full text and rfc822 format available.

Notification sent to Michael Rohleder <mike <at> rohleder.de>:
bug acknowledged by developer. (Mon, 07 Mar 2022 20:24:01 GMT) Full text and rfc822 format available.

Message #37 received at 53623-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Michael Rohleder <mike <at> rohleder.de>
Cc: 53623-done <at> debbugs.gnu.org, Leo Famulari <leo <at> famulari.name>,
 Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Subject: Re: bug#53623: [PATCH] gnu: mosh: Fix path to binaries.
Date: Mon, 07 Mar 2022 21:23:00 +0100
Hi Michael,

Michael Rohleder <mike <at> rohleder.de> skribis:

> Ludovic Courtès <ludo <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Apr 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.