[X2Go-Commits] [libx2goclient] 02/13: src/x2goclient-openssh-bugs.{c, h}: implement first bugs shim: backgrounding_keeps_stderr.

git-admin at x2go.org git-admin at x2go.org
Sat Jun 27 14:42:19 CEST 2020

This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository libx2goclient.

commit 417e73c69cdf6329ee25571436ae302cc5db9c02
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Jun 20 07:54:13 2020 +0200

    src/x2goclient-openssh-bugs.{c,h}: implement first bugs shim: backgrounding_keeps_stderr.
    Current versions of OpenSSH do not completely detach when master mode
    and persistence are turned on and detaching requested. They keep stdin
    and stderr open when detaching, which we consider a bug.
    stdin is uncritical, since we will close it anyway.
    stderr is a problem, since the initially launched program keeps
    connected to the pipe. Usually, we would not care about that, but that
    also means that the pipe will not close until the persistent master
    connection process terminates, which is, by design, way after the
    initial command executed (if we even wanted to execute a process and not
    just launch a persistent master connection anyway). In essence, this
    means that we will not be able to continue until the persistent process
    terminated, leaving everything in vain.
    We can work around that by dropping the stderr connection and lose out
    on any information sent over that line, but later OpenSSH client
    versions might fix that bug in which case stderr will be closed at the
    fork point, not needing the close workaround any longer (and also being
    able to fetch information via stderr.)
 src/x2goclient-openssh-bugs.c | 1 +
 src/x2goclient-openssh-bugs.h | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/x2goclient-openssh-bugs.c b/src/x2goclient-openssh-bugs.c
index 525656b..b2f540a 100644
--- a/src/x2goclient-openssh-bugs.c
+++ b/src/x2goclient-openssh-bugs.c
@@ -74,6 +74,7 @@ gboolean x2goclient_openssh_bugs_update (X2GoClientOpenSSHBugs *self, const X2Go
   if (8 >= version->major) {
     if (2 >= version->minor) {
+      self->backgrounding_keeps_stderr = TRUE;
diff --git a/src/x2goclient-openssh-bugs.h b/src/x2goclient-openssh-bugs.h
index ef0ae5d..9714c5a 100644
--- a/src/x2goclient-openssh-bugs.h
+++ b/src/x2goclient-openssh-bugs.h
@@ -25,6 +25,8 @@
 #ifndef x2goclient_openssh_bugs_h
 #define x2goclient_openssh_bugs_h
+#include <stdbool.h>
 #include <glib-object.h>
 #include "x2goclient-openssh-version.h"
@@ -41,6 +43,13 @@ G_BEGIN_DECLS
  * want this to happen as well.
 typedef struct X2GoClientOpenSSHBugs_ {
+  /*
+   * Normally, child processes should fully detach from the controlling
+   * terminal. OpenSSH is buggy in some cases and doesn't always do that.
+   *
+   * C.f., https://bugzilla.mindrot.org/show_bug.cgi?id=3137
+   */
+  _Bool backgrounding_keeps_stderr : 1;
 } X2GoClientOpenSSHBugs;

Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git

More information about the x2go-commits mailing list