Xpra: Ticket #1599: ssh start may run xpra command multiple times

We should ensure that we only start a single instance with "proxy_start" by using if+elif+else statements.

With r16498, the proxy start command line ends up looking like this:

XPRA_SSH_DEBUG=1 xpra start ssh:test@localhost --start=xterm
executing ssh command: "ssh" "-x" "-l" "guest" "-T" "localhost" "sh -c 'xpra initenv;\
    ~/.xpra/run-xpra _proxy_start "--start=xterm" \
    || $XDG_RUNTIME_DIR/xpra/run-xpra _proxy_start "--start=xterm" \
    || xpra _proxy_start "--start=xterm" \
    || /usr/local/bin/xpra _proxy_start "--start=xterm"'"

Which means we can run the same subcommand N times (here N=4) if it fails. This causes problems if we're trying to start a server... as we could end up starting it N times.

Tue, 25 Jul 2017 08:49:11 GMT - Antoine Martin: status, description changed

r16499 does this, the ssh command line looks like this now:

executing ssh command: "ssh" "-x" "-l" "guest" "-T" "localhost" "sh -c 'xpra initenv;\
    if [ -x "~/.xpra/run-xpra" ]; then ~/.xpra/run-xpra _proxy_start "--start=xterm";\
    elif [ -x "$XDG_RUNTIME_DIR/xpra/run-xpra" ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy_start "--start=xterm";\
    elif type "xpra" > /dev/null 2>&1; then xpra _proxy_start "--start=xterm";\
    elif [ -x "/usr/local/bin/xpra" ]; then /usr/local/bin/xpra _proxy_start "--start=xterm";\
    else echo "no run-xpra command found"; exit 1; fi'"

It is very very late in the release cycle (2.1 has already been tagged: r16496), but I am considering this for inclusion in 2.1

Tue, 25 Jul 2017 08:50:42 GMT - Antoine Martin: summary changed

r16500 is also needed because:

$ sh -c 'if [ -x "~/.xpra/run-xpra" ]; then echo yes; else echo no; fi'
$ sh -c 'if [ -x ~/.xpra/run-xpra ]; then echo yes; else echo no; fi'

Wed, 26 Jul 2017 07:30:11 GMT - Antoine Martin: status changed; resolution set

Was included in the 2.1 release: r16505.

Sat, 23 Jan 2021 05:28:45 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1599