Subject: x2goserver: Broken x2goversion results in failed connection

From: Randy Goldenberg <[email-masked]>
Date: Mon, 18 May 2020 23:00:45 -0700

Package: x2goserver
Version: 4.1.0.3-0~1708~ubuntu16.04.1

Attempts to connect to x2goserver fail, with error message "the remote server 
does not have the X2Go Server software installed". Transcript is provided 
below.  Issue appears to be caused by what is likely a typo in x2goversion.  
Patch attached.

pyhoca-cli[2151] NOTICE: preparing requested X2Go session
pyhoca-cli[2151] (PyHocaCLI) NOTICE: preparing requested X2Go session
pyhoca-cli[2151] (x2goinifiles-pylib) INFO: proposed config files are ['/home/some_user/.x2goclient/sessions']
pyhoca-cli[2151] (x2goinifiles-pylib) INFO: config files found: ['/home/some_user/.x2goclient/sessions']
pyhoca-cli[2151] (x2goinifiles-pylib) INFO: proposed config files are ['/home/some_user/.x2goclient/settings']
pyhoca-cli[2151] (x2goinifiles-pylib) INFO: config files found: ['/home/some_user/.x2goclient/settings']
pyhoca-cli[2151] (x2goinifiles-pylib) INFO: proposed config files are ['/home/some_user/.x2goclient/printing']
pyhoca-cli[2151] (x2goinifiles-pylib) INFO: config files found: ['/home/some_user/.x2goclient/printing']
pyhoca-cli[2151] (x2gosession-pylib) DEBUG: X2Go control session parameters for profile Pyhoca-Client_Session:
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     look_for_keys: True
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     unique_hostkey_aliases: False
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     username: some_user
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     key_filename: /home/some_user/.ssh/id_rsa
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     allow_agent: True
pyhoca-cli[2151] (x2gosession-pylib) DEBUG: X2Go terminal session parameters for profile Pyhoca-Client_Session:
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     pack: 16m-jpeg-9
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     clipboard: both
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     xinerama: False
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     applications: ['WWWBROWSER', 'MAILCLIENT', 'OFFICE', 'TERMINAL']
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     kdrive: False
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     set_session_title: False
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     session_title: 
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     link: adsl
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     server_encoding: UTF-8
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     client_encoding: UTF-8
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     convert_encoding: False
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     kblayout: null
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     kbtype: auto
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     kbvariant: null
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     snd_system: pulse
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     snd_port: 4713
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     cmd: openbox-session
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     published_applications: False
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     rdp_options: -u X2GO_USER -p X2GO_PASSWORD
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     rdp_server: 
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     xdmcp_server: localhost
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     geometry: maximize
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     session_type: desktop
pyhoca-cli[2151] (x2gosession-pylib) DEBUG: X2Go sshproxy parameters for profile Pyhoca-Client_Session:
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     sshproxy_host: proxyhost.mydomain
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     sshproxy_port: 22
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     sshproxy_user: 
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     sshproxy_key_filename: 
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     sshproxy_look_for_keys: True
pyhoca-cli[2151] (x2gosession-pylib) DEBUG:     sshproxy_allow_agent: True
pyhoca-cli[2151] (x2gosession-pylib) DEBUG: initializing X2GoControlSession
pyhoca-cli[2151] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session...
pyhoca-cli[2151] (x2gosessregistry-pylib) DEBUG: registering X2Go session with UUID b72abe00-996b-11ea-9a8e-d543e4783396
pyhoca-cli[2151] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-cli[2151] (x2gocontrolsession-pylib) NOTICE: connecting to [rg1.lan]:1957
pyhoca-cli[2151] (x2gocontrolsession-pylib) DEBUG: trying SSH key discovery or agent authentication with server
pyhoca-cli[2151] (x2gocontrolsession-pylib) INFO: executing command on X2Go server ,,Pyhoca-Client_Session'': echo X2GODATABEGIN:b72abe01-996b-11ea-9a8e-d543e4783396; PATH=/usr/local/bin:/usr/bin:/bin sh -c "which x2gofeaturelist >/dev/null && x2gofeaturelist"; echo X2GODATAEND:b72abe01-996b-11ea-9a8e-d543e4783396
pyhoca-cli[2151] (x2gocontrolsession-pylib) DEBUG: server-side X2Go features are: ['X2GOAGENT_RANDRXINERAMA', 'X2GO_CLIPBOARD_MODES', 'X2GO_FMBINDINGS', 'X2GO_LIST_DESKTOPS', 'X2GO_LIST_SHADOWSESSIONS', 'X2GO_LXDEBINDINGS', 'X2GO_MOUNTDIRS', 'X2GO_MOUNT_UNCPATHS', 'X2GO_PRINTING', 'X2GO_PUBLISHED_APPLICATIONS', 'X2GO_RUN_EXTENSIONS', 'X2GO_SERVERSIDE_DESKTOPCOMMANDS', 'X2GO_SET_KEYBOARD', 'X2GO_UMOUNTSESSION_ALL', 'X2GO_UMOUNTSESSION_ONLYPATH', 'X2GO_XSESSION']
pyhoca-cli[2151] (x2gocontrolsession-pylib) INFO: executing command on X2Go server ,,Pyhoca-Client_Session'': echo X2GODATABEGIN:b72abe02-996b-11ea-9a8e-d543e4783396; PATH=/usr/local/bin:/usr/bin:/bin sh -c "echo $HOME"; echo X2GODATAEND:b72abe02-996b-11ea-9a8e-d543e4783396
pyhoca-cli[2151] (x2gocontrolsession-pylib) DEBUG: remote user' home directory: /home/some_user
pyhoca-cli[2151] (x2gocontrolsession-pylib) DEBUG: executing command on X2Go server ,,Pyhoca-Client_Session'': echo X2GODATABEGIN:b72abe03-996b-11ea-9a8e-d543e4783396; PATH=/usr/local/bin:/usr/bin:/bin sh -c "stat -tL "/home/some_user""; echo X2GODATAEND:b72abe03-996b-11ea-9a8e-d543e4783396
pyhoca-cli[2151] (x2gocontrolsession-pylib) INFO: executing command on X2Go server ,,Pyhoca-Client_Session'': echo X2GODATABEGIN:b72abe04-996b-11ea-9a8e-d543e4783396; PATH=/usr/local/bin:/usr/bin:/bin sh -c "export HOSTNAME && { x2golistsessions; x2golistshadowsessions; }"; echo X2GODATAEND:b72abe04-996b-11ea-9a8e-d543e4783396
pyhoca-cli[2151] (x2gocontrolsession-pylib) INFO: executing command on X2Go server ,,Pyhoca-Client_Session'': echo X2GODATABEGIN:b72abe05-996b-11ea-9a8e-d543e4783396; PATH=/usr/local/bin:/usr/bin:/bin sh -c "which x2goversion >/dev/null && x2goversion"; echo X2GODATAEND:b72abe05-996b-11ea-9a8e-d543e4783396
pyhoca-cli[2151] (x2gocontrolsession-pylib) DEBUG: server-side X2Go components and their versions are: {'': '4.1.0.3'}
pyhoca-cli: error: the remote server does not have the X2Go Server software installed
pyhoca-cli[2151] (x2goguardian-pylib) DEBUG: X2Go session guardian thread waking up after 2 seconds
pyhoca-cli[2151] (x2goguardian-pylib) DEBUG: calling session cleanup on profile Pyhoca-Client_Session for terminal session: 

OS is Ubuntu 16.04.6 LTS.   Client attempting to connect is pyhoca-cli version 
0.6.1.2, running on Ubuntu 20.04 LTS.  x2goserver was obtained from 
http://ppa.launchpad.net/x2go/stable/ubuntu/pool/main/x/x2goserver/x2goserver_4.1.0.3-0~1708~ubuntu16.04.1_amd64.deb
diff --git a/x2goversion b/x2goversion.fixed
index aa960a2..50e45c0 100755
--- a/x2goversion
+++ b/x2goversion.fixed
@@ -42,7 +42,7 @@ if [ -n "${1}" ]; then
 else
 	cd "${X2GO_VERSIONS_BASEPATH}"
 	for compfile in "${X2GO_VERSIONS_BASEPATH}"/*; do
-		X2GO_COMPONENT="$(echo "${compfile}" | cut -d '.' -f '2')"
+		X2GO_COMPONENT="$(echo "$(basename ${compfile})" | cut -d '.' -f '2')"
 		X2GO_COMPONENT_VERSION="$(get_version "${compfile}")"
 		echo "${X2GO_COMPONENT}: ${X2GO_COMPONENT_VERSION}"
 	done