Subject: Bug#1591: wslvar and wslpath do not work in tmux session that is started on x2goserver

From: Alezender Tan <[email-masked]>
Date: Fri, 19 Aug 2022 19:44:36 +0200

Package: x2goserver
Version: 4.1.0.3-5

wslvar and wslpath do not work in tmux session that is started on x2goserver

Relevant issues:
- tmux: https://github.com/tmux/tmux/issues/3295
- WSL: https://github.com/microsoft/WSL/issues/8706

Environment:
  1. Client OS: Microsoft Windows [Version 10.0.19042.1466]
  2. Client version: 4.1.2.2 (Qt - 4.8.6)
  3. Server OS:
    a. Kernel version: Linux version
5.10.102.1-microsoft-standard-WSL2 (oe-user@oe-host)
(x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils)
2.34.0.20200220)
    b. Distro version:
```
Distributor ID: Ubuntu
Description: Ubuntu Jammy Jellyfish (development branch)
Release: 22.04
Codename: jammy
```
  4. x2goserver version: `dpkg --status x2goserver` returns
```
Package: x2goserver
Status: install ok installed
Priority: optional
Section: x11
Installed-Size: 420
Maintainer: Ubuntu Developers <[email-masked]>
Architecture: amd64
Version: 4.1.0.3-5
Replaces: x2goserver-compat, x2goserver-home, x2goserver-one, x2goserver-pyhoca
Depends: bc, libfile-basedir-perl, libfile-which-perl, libswitch-perl,
libtry-tiny-perl, libx2go-server-perl (<< 4.1.0.3-5.1~),
libx2go-server-perl (>= 4.1.0.3-5), lsb-base, lsof, net-tools,
openssh-client, openssh-server, perl, psmisc, pwgen, x2goserver-common
(<< 4.1.0.3-5.1~), x2goserver-common (>= 4.1.0.3-5),
x2goserver-x2goagent (<< 4.1.0.3-5.1~), x2goserver-x2goagent (>=
4.1.0.3-5), xauth, xkb-data, debconf (>= 0.5) | debconf-2.0
Pre-Depends: init-system-helpers (>= 1.54~)
Recommends: fontconfig, sshfs, x11-apps, x11-session-utils, x11-utils,
x11-xfs-utils, x11-xkb-utils, x11-xserver-utils, x2goserver-extensions
(<< 4.1.0.3-5.1~), x2goserver-extensions (>= 4.1.0.3-5),
x2goserver-fmbindings (<< 4.1.0.3-5.1~), x2goserver-fmbindings (>=
4.1.0.3-5), x2goserver-printing (<< 4.1.0.3-5.1~), x2goserver-printing
(>= 4.1.0.3-5), x2goserver-xsession (<< 4.1.0.3-5.1~),
x2goserver-xsession (>= 4.1.0.3-5), xfonts-base, xinit
Suggests: pulseaudio-utils, rdesktop
Breaks: x2godesktopsharing (<< 3.1.1.2-0~), x2goserver-compat (<<
4.0.1.99~), x2goserver-home, x2goserver-one, x2goserver-pyhoca (<<
4.0.1.99~)
...
```
  5. x2goserver-xsession version: `dpkg --status x2goserver-xsession` returns
```
Package: x2goserver-xsession
Status: install ok installed
Priority: optional
Section: x11
Installed-Size: 54
Maintainer: Ubuntu Developers <[email-masked]>
Architecture: all
Source: x2goserver
Version: 4.1.0.3-5
Depends: dbus, perl:any, x11-common, x2goserver (<< 4.1.0.3-5.1~),
x2goserver (>= 4.1.0.3-5)
...
```
  6. nxagent version: `dpkg --status nxagent` returns
```
Package: nxagent
Status: install ok installed
Priority: optional
Section: x11
Installed-Size: 4806
Maintainer: Ubuntu Developers <[email-masked]>
Architecture: amd64
Multi-Arch: foreign
Source: nx-libs
Version: 2:3.5.99.26-5
Replaces: libxcompext3, nxauth
Depends: libnx-x11-6 (= 2:3.5.99.26-5), libxcomp3 (= 2:3.5.99.26-5),
libxcompshad3 (= 2:3.5.99.26-5), x11-xkb-utils, libc6 (>= 2.34),
libjpeg8 (>= 8c), libpixman-1-0 (>= 0.13.2), libpng16-16 (>= 1.6.2-1),
libtirpc3 (>= 1.0.2), libx11-6 (>= 2:1.4.99.1), libxcomposite1 (>=
1:0.4.5), libxdmcp6, libxext6, libxfixes3, libxfont2 (>= 1:2.0.1),
libxinerama1, libxml2 (>= 2.7.4), libxpm4, libxrender1, zlib1g (>=
1:1.1.4)
Recommends: xfonts-base, xkb-data
Breaks: libxcompext3 (<< 2:3.5.99.3~), nxauth
...
```

Steps to reproduce:
  1. Install and setup WSL2 based on
https://docs.microsoft.com/en-us/windows/wsl/install (exact component
versions can be found at https://github.com/microsoft/WSL/issues/8706)
  2. Install x2goserver in WSL2 based on
https://wiki.x2go.org/doku.php/doc:installation:x2goserver
  3. Install x2goclient on host Windows system based on
https://wiki.x2go.org/doku.php/doc:installation:x2goclient
  4. Download tarball from
https://github.com/tmux/tmux/releases/tag/3.3a (currently latest
version, older version i.e. 3.2a installed via `sudo apt install tmux`
also encounters same problem)
  5. Install tarball in WSL2 based on instructions at
https://github.com/tmux/tmux/wiki/Installing#from-source-tarball
  6. Start session on x2goclient and run `tmux`
  7. Run `wslvar -S` within tmux session
  8. Run `wslpath -w "${HOME}"` within tmux session

Expected results:
  1. output of `wslvar -S` within tmux should be
```
Name                           Value
----                           -----
ALLUSERSPROFILE                C:\ProgramData
...
windir                         C:\Windows
ZES_ENABLE_SYSMAN              1
```
  2.  output of `wslpath -w "${HOME}"` within tmux should be
`\\wsl$\<distro_name>\home\<username>`

Actual results:
  1. Running `wslvar -S` within tmux running on x2goserver yields no output
  2. Running `wslpath -w "${HOME}"` within tmux on x2goserver returns
`wslpath: /home/<username>: Invalid argument`

Further information:
As mentioned at
https://github.com/microsoft/WSL/issues/8706#issuecomment-1211326423,
running tmux in WSL2 shell first then on x2goserver causes `wslvar -S`
and `wslpath -w "${HOME}"` to work properly but they break if tmux is
run on x2goserver first