From 2cb38da6e92bb9e7032f3ff1fdc6e89ced0c459b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 16 Aug 2021 22:22:55 +0100 Subject: [PATCH] psusan manpage: suggest setsid in UML example. When UML terminates, it kills its entire process group. The way PuTTY invokes proxy processes, they are part of its process group. So if UML is used directly as the proxy process, it will commit patricide on termination. Wrapping it in 'setsid' is overkill (it doesn't need to be part of a separate _session_, only a separate pgrp), but it's good enough to work around this problem, and give PuTTY the opportunity to shut down cleanly when the UML it's talking to vanishes. --- doc/man-psusan.but | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/man-psusan.but b/doc/man-psusan.but index 4d7638dd..7877b3c8 100644 --- a/doc/man-psusan.but +++ b/doc/man-psusan.but @@ -198,12 +198,22 @@ And the setup script \cw{uml-psusan.sh} might look like this: \e iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii \c exec /home/simon/src/putty/misc/psusan -Now set up a PuTTY saved session as in the Docker example above, using -that \cw{linux} command as the local proxy command. You may also find -that you have to enable the bug workaround that indicates that the -server \q{Discards data sent before its greeting}, because otherwise -PuTTY's outgoing protocol greeting can be accidentally lost during UML -startup. (See +Now set up a PuTTY saved session as in the Docker example above. +Basically you'll want to use the above \cw{linux} command as the local +proxy command. However, it's worth wrapping it in \c{setsid}(\e{1}), +because when UML terminates, it kills its entire process group. So +it's better that PuTTY should not be part of that group, and should +have the opportunity to shut down cleanly by itself. So probably you +end up setting the proxy command to be something more like: + +\c setsid linux mem=512M rootfstype=hostfs rootflags=/ rw \ +\c con=fd:2,fd:2 ssl0=fd:0,fd:1 init=/some/path/to/uml-psusan.sh +\e iiiiiiiiiiiiiiiiiiiiiiiiiii + +You may also find that you have to enable the bug workaround that +indicates that the server \q{Discards data sent before its greeting}, +because otherwise PuTTY's outgoing protocol greeting can be +accidentally lost during UML startup. (See \W{https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991958}{Debian bug #991958}.)