[X2Go-Commits] [x2goserver] 01/07: x2goserver/bin/x2goresume-session: handle missing xinerama parameter in options string gracefully, skipping that part (and the other optional geometry string) correctly.

git-admin at x2go.org git-admin at x2go.org
Wed Jan 24 11:57:41 CET 2018


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

x2go pushed a commit to branch master
in repository x2goserver.

commit b095393f62f5349e4ab5e265368ce5c0d6dc66fa
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Jan 24 09:15:02 2018 +0100

    x2goserver/bin/x2goresume-session: handle missing xinerama parameter in options string gracefully, skipping that part (and the other optional geometry string) correctly.
---
 debian/changelog                  |  3 +++
 x2goserver/bin/x2goresume-session | 28 ++++++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 13d9c6f..eb8f964 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -237,6 +237,9 @@ x2goserver (4.1.0.0-0x2go1.2) UNRELEASED; urgency=low
       work around that gracefully.
     - x2goserver/lib/x2goistrue: use shift unconditionally and check the
       parameter to be defined instead.
+    - x2goserver/bin/x2goresume-session: handle missing xinerama parameter in
+      options string gracefully, skipping that part (and the other optional
+      geometry string) correctly.
   * x2goserver.spec:
     - Only create session DB in x2goserver's post install script. Do use
       proper Requires(post) statements to make sure perl-X2Go-Server-DB and
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index 9adbc11..2e1b905 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -259,16 +259,40 @@ PSTR="$(awk -F ',' '{print $3}' <<< "${OPTIONS}")"
 KTSTR="$(awk -F ',' '{print $12}' <<< "${OPTIONS}")"
 GSTR="$(awk -F ',' '{print $13}' <<< "${OPTIONS}")"
 typeset xinerama_orig=''
-test_GSTR="$(sed 's/geometry=.*//' <<< "${GSTR}")"
+test_GSTR="$(sed -e 's/geometry=.*//' <<< "${GSTR}")"
 if [[ -n "${test_GSTR}" ]]; then
 	GSTR='geometry='
 	xinerama_orig="$(awk -F ',' '{print $13}' <<< "${OPTIONS}")"
+else
+	xinerama_orig="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")"
+fi
+
+# Sessions started with older X2Go Server versions do not feature
+# a xinerama option, so handle this gracefully.
+# Note that Xinerama support defaulted to on and was handled by the client,
+# so keep it like that.
+typeset test_xinerama="$(sed -e 's/xinerama=.*//' <<< "${xinerama_orig}")"
+if [[ -n "${test_xinerama}" ]]; then
+	# Will not actually be replaced by anything, so the value provided
+	# here does not matter.
+	xinerama_orig='xinerama=1'
+fi
+
+# Only one component missing => either geometry or xinerama at position 13,
+# everything else starts from position 14.
+if { [[ -n "${test_GSTR}" ]] && [[ -z "${test_xinerama}" ]]; } || { [[ -z "${test_GSTR}" ]] && [[ -n "${test_xinerama}" ]]; }; then
 	RSTR="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")"
 	FSTR="$(awk -F ',' '{print $15}' <<< "${OPTIONS}")"
 	LISTSTR="$(awk -F ',' '{print $17}' <<< "${OPTIONS}")"
 	CLIPBOARD="$(awk -F ',' '{print $18}' <<< "${OPTIONS}")"
+# Neither geometry nor xinerama given, everything else starts at position 13.
+elif [[ -n "${test_GSTR}" ]]; then
+	RSTR="$(awk -F ',' '{print $13}' <<< "${OPTIONS}")"
+	FSTR="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")"
+	LISTSTR="$(awk -F ',' '{print $16}' <<< "${OPTIONS}")"
+	CLIPBOARD="$(awk -F ',' '{print $17}' <<< "${OPTIONS}")"
+# Both geometry and xinerama given, everything else starts at position 15.
 else
-	xinerama_orig="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")"
 	RSTR="$(awk -F ',' '{print $15}' <<< "${OPTIONS}")"
 	FSTR="$(awk -F ',' '{print $16}' <<< "${OPTIONS}")"
 	LISTSTR="$(awk -F ',' '{print $18}' <<< "${OPTIONS}")"

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


More information about the x2go-commits mailing list