‘lshg -G’ aborts

Niels Möller nisse at lysator.liu.se
Mon Jan 13 10:26:23 CET 2014


ludo at gnu.org (Ludovic Courtès) writes:

> --8<---------------cut here---------------start------------->8---
> $ lshg -G fencepost.gnu.org
> Passphrase for key `xxx at yyy': 
> Aborted
> --8<---------------cut here---------------end--------------->8---
>
> A look at the strace output suggests an assertion failure in one of the
> child processes:
>
> --8<---------------cut here---------------start------------->8---
> write(2, "lshg: sys.c:109: sys_on_fd: Assertion `((void *)0) == sys->files[fd][ev].f && \"multiple handlers registered for a file event\"' failed.\n", 135) = 135
> --8<---------------cut here---------------end--------------->8---
>
> Any ideas?

It looks like lshg sets the close-on-exec flag on the stdio file
descriptors, before execing lsh. Which maybe is why you don't get to see
that assertion failure message.

Can you try the following patch? To be applied to the branch
"lsh-2.0.4".

Regards,
/Niels

diff --git a/src/client.c b/src/client.c
index c5dd3e5..d580e68 100644
--- a/src/client.c
+++ b/src/client.c
@@ -974,7 +974,7 @@ make_client_session(struct client_options *options)
 	in = open("/dev/null", O_RDONLY);
       else 
 	{
-	  in = STDIN_FILENO;
+	  in = dup(STDIN_FILENO);
 	  in_type = IO_STDIO;
 	  is_tty = isatty(STDIN_FILENO);
 	  
@@ -1023,7 +1023,7 @@ make_client_session(struct client_options *options)
   else
     {
       out_type = IO_STDIO;
-      out = STDOUT_FILENO;
+      out = dup(STDOUT_FILENO);
     }
   if (out < 0)
     {
@@ -1040,7 +1040,7 @@ make_client_session(struct client_options *options)
   else
     {
       err_type = IO_STDERR;
-      err = STDERR_FILENO;
+      err = dup(STDERR_FILENO);
     }
   if (err < 0) 
     {


-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.



More information about the lsh-bugs mailing list