Subject: user resources not being read
From: Hanno Foest <[email-masked]>
To: [email-masked]
Date: Mon, 28 Feb 2022 22:46:13 +0100

Package: x2goserver-xsession
Version: 4.1.0.4-0x2go1.2~git20220217.1940+11.heuler.1

I noticed that the user resources (ie, $HOME/.Xresources-x2go) are not
being read on my new Devuan Chimaera instance (should be the same for
Debian stable).

xsession-x2go-errors told me that "has_option" command was not found:

grep has_option .xsession-x2go-gui3-errors
/etc/x2go/Xsession.d/30x11-common_xresources: Zeile 16: has_option:
Kommando nicht gefunden.

Upon investigation, it looks like this command, and reading of the
option file Xsession.options, used to be defined in
/etc/X11/Xsession.d/20x11-common_process-args, but now resides in
/etc/X11/Xsession. /etc/x2go/Xsession is a modified copy of
/etc/X11/Xsession, but this change was not made.

Copying the relevant lines over from /etc/X11/Xsession made things work
again. Patch attached (please bear with me - I'm a sysadmin, not a
developer).

Hanno
diff -u /etc/x2go/Xsession.orig /etc/x2go/Xsession
--- /etc/x2go/Xsession.orig     2022-02-17 22:09:39.000000000 +0100
+++ /etc/x2go/Xsession  2022-02-20 00:46:48.847537872 +0100
@@ -77,6 +77,24 @@
 ALTUSERXSESSION=$HOME/.Xsession-x2go
 ERRFILE="${HOME}/.xsession-x2go-${cur_hostname}-errors"
 
+OPTIONS="$(
+  if [ -r "$OPTIONFILE" ]; then
+    cat "$OPTIONFILE"
+  fi
+  if [ -d /etc/X11/Xsession.options.d ]; then
+    run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d '\n' cat
+  fi
+)"
+
+has_option() {
+  # Ensure that a later no-foo overrides an earlier foo
+  if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
 # Move the old error log file away.
 if [ -f "${ERRFILE}" ]; then
        if [ -L "${ERRFILE}" ]; then