Xpra: Ticket #2659: CWD of new xpra server is not sanitized (i.e. ~)

Splitting from #2606

Are invocations "sanitized"?

What invocation?

Is local invocation "equivalent" to what I would get if I did it remotely?

I'm not sure I understand the question. Is it related to this ticket?

From remote start, gnome-terminal seems to start in different CWD all the time.

It depends what type of remote start you are using. Unless you change the chdir option, the server starts does not change the CWD, so this will be set by the caller. (ie: for ssh start, whatever sshd + shell are using)

After seeing #2604, I started closing all apps in the client, so I can re-start it anew.

When I started the new client, the cwd of the spawning gnome-terminal was the same as the last directory I cded to on the previous instance of the client.



Sat, 21 Mar 2020 16:01:54 GMT - Antoine Martin: owner changed

Using:

cd /
xpra start --start=xterm --attach=yes

Running pwd in the xterm shows /.

Doing the same thing in "~" or any other path gives the expected result: the path of the commands started by the server is where the server was started from.

When starting a server via ssh, the CWD is always "~".

If you find that this is not the case, please provide specific command lines to reproduce.


Wed, 25 Mar 2020 16:01:04 GMT - Antoine Martin: status changed; resolution set


Mon, 26 Oct 2020 08:35:08 GMT - stdedos:

I think here you assumed local execution. I am talking about remote invocation:

"Xpra-Python3-x86_64_4.1-r27735\xpra_cmd" start ssh://user@ip/4 -d ssh --microphone=off --speaker=off --webcam=no --pulseaudio=no --start=gnome-terminal
XPRA_EXECUTABLE=Xpra-Python3-x86_64_4.1-r27735
2020-10-26 09:37:09,688 parse_ssh_string(auto)
2020-10-26 09:37:09,991 using paramiko ssh backend
2020-10-26 09:37:11,108 Xpra GTK3 client version 4.1-r27735 64-bit
2020-10-26 09:37:11,110  running on Microsoft Windows 10
2020-10-26 09:37:16,890 GStreamer version 1.18.0 for Python 3.8.6 64-bit
2020-10-26 09:37:16,920 created named pipe 'Xpra\12680'
2020-10-26 09:37:17,268 keyboard layout code 0x409
2020-10-26 09:37:17,269 identified as 'United States - English' : us
2020-10-26 09:37:17,539 OpenGL_accelerate module loaded
2020-10-26 09:37:17,615 Using accelerated ArrayDatatype
2020-10-26 09:37:18,604 Warning: vendor 'Intel' is greylisted,
2020-10-26 09:37:18,605  you may want to turn off OpenGL if you encounter bugs
2020-10-26 09:37:18,922 OpenGL enabled with Intel(R) HD Graphics 4000
2020-10-26 09:37:18,963 paramiko socket_connect: sockname=('ip-src', 62310), peername=('ip-dest', 22)
2020-10-26 09:37:18,979 Connected (version 2.0, client OpenSSH_7.2p2)
2020-10-26 09:37:19,014 do_ssh_paramiko_connect_to(<paramiko.Transport at 0x9e51be0 (cipher aes128-ctr, 128 bits) (connected; awaiting auth)>, 'ip-dest', 'ulinx', None, {'hostname': '*'}, ['C:\\Users\\user.win/.ssh\\id_ed25519', 'C:\\Users\\user.win/.ssh\\id_ecdsa', 'C:\\Users\\user.win/.ssh\\id_rsa', 'C:\\Users\\user.win/.ssh\\id_dsa'], {'display_name': 'ssh://ulinx@ip-dest/4', 'type': 'ssh', 'proxy_command': ['_proxy_start'], 'exit_ssh': True, 'display': ':4', 'display_as_args': [':4', '--debug=ssh', '--speaker=off', '--start=gnome-terminal'], 'is_paramiko': True, 'username': 'ulinx', 'port': 22, 'host': 'ip-dest', 'local': False, 'full_ssh': ['paramiko'], 'remote_xpra': ['$XDG_RUNTIME_DIR/xpra/run-xpra', 'xpra', '/usr/local/bin/xpra', '~/.xpra/run-xpra', 'Xpra_cmd.exe']})
2020-10-26 09:37:19,018 SSH transport <paramiko.Transport at 0x9e51be0 (cipher aes128-ctr, 128 bits) (connected; awaiting auth)>
2020-10-26 09:37:19,019 remote_server_key=MD5:b1:b5:b4:0f:49:ab:62:2d:7c:1d:73:de:6e:26:82:a9
2020-10-26 09:37:19,022 HostKeys.load(C:\Users\user.win/ssh/known_hosts) successful
2020-10-26 09:37:19,023 host keys=<paramiko.hostkeys.HostKeys object at 0x0000000009e861f0>
2020-10-26 09:37:19,024 ed25519 host key 'MD5:b1:b5:b4:0f:49:ab:62:2d:7c:1d:73:de:6e:26:82:a9' OK for host 'ip-dest'
2020-10-26 09:37:19,025 starting authentication, authentication methods: ['none', 'agent', 'key', 'password']
2020-10-26 09:37:19,027 auth=none
2020-10-26 09:37:19,031 trying none authentication
2020-10-26 09:37:19,093 auth_none()
Traceback (most recent call last):
  File "E:\Xpra\trunk\src/xpra/net/ssh.py", line 633, in auth_none
  File "C:/msys64/mingw64/lib/python3.8/site-packages/paramiko/transport.py", line 1446, in auth_none
  File "C:/msys64/mingw64/lib/python3.8/site-packages/paramiko/auth_handler.py", line 250, in wait_for_response
paramiko.ssh_exception.BadAuthenticationType: Bad authentication type; allowed types: ['publickey', 'password']
2020-10-26 09:37:19,098 auth=agent
2020-10-26 09:37:19,103 agent keys: ()
2020-10-26 09:37:19,104 auth=key
2020-10-26 09:37:19,105 trying public key authentication using ['C:\\Users\\user.win/.ssh\\id_ed25519', 'C:\\Users\\user.win/.ssh\\id_ecdsa', 'C:\\Users\\user.win/.ssh\\id_rsa', 'C:\\Users\\user.win/.ssh\\id_dsa']
2020-10-26 09:37:19,106 no keyfile at 'C:\Users\user.win/.ssh\id_ed25519'
2020-10-26 09:37:19,109 no keyfile at 'C:\Users\user.win/.ssh\id_ecdsa'
2020-10-26 09:37:19,111 no keyfile at 'C:\Users\user.win/.ssh\id_rsa'
2020-10-26 09:37:19,112 no keyfile at 'C:\Users\user.win/.ssh\id_dsa'
2020-10-26 09:37:19,113 auth=password
2020-10-26 09:37:19,114 trying interactive authentication
2020-10-26 09:37:19,144 auth_interactive(..)
Traceback (most recent call last):
  File "E:\Xpra\trunk\src/xpra/net/ssh.py", line 662, in auth_interactive
  File "C:/msys64/mingw64/lib/python3.8/site-packages/paramiko/transport.py", line 1633, in auth_interactive
  File "C:/msys64/mingw64/lib/python3.8/site-packages/paramiko/auth_handler.py", line 250, in wait_for_response
paramiko.ssh_exception.BadAuthenticationType: Bad authentication type; allowed types: ['publickey', 'password']
2020-10-26 09:37:19,148 SSH password authentication failed:
2020-10-26 09:37:19,150  Bad authentication type; allowed types: ['publickey', 'password']
please enter the SSH password for ulinx@ip-dest:
2020-10-26 09:37:41,259 trying password authentication
2020-10-26 09:37:41,302 Authentication (password) successful!
2020-10-26 09:37:41,304 will try to run xpra from: ['$XDG_RUNTIME_DIR/xpra/run-xpra', 'xpra', '/usr/local/bin/xpra', '~/.xpra/run-xpra', 'Xpra_cmd.exe']
2020-10-26 09:37:41,306 run_test_command('which $XDG_RUNTIME_DIR/xpra/run-xpra')
2020-10-26 09:37:41,871 exec_command('which $XDG_RUNTIME_DIR/xpra/run-xpra')=0, out=b'/run/user/1000/xpra/run-xpra\n', err=b''
2020-10-26 09:37:41,874 cmd(['_proxy_start'], [':4', '--debug=ssh', '--speaker=off', '--start=gnome-terminal'])="$XDG_RUNTIME_DIR/xpra/run-xpra" "_proxy_start" ":4" "--debug=ssh" "--speaker=off" "--start=gnome-terminal"
2020-10-26 09:37:41,875 trying to open SSH session, window-size=134217727, timeout=60
2020-10-26 09:37:41,936 channel exec_command("$XDG_RUNTIME_DIR/xpra/run-xpra" "_proxy_start" ":4" "--debug=ssh" "--speaker=off" "--start=gnome-terminal")
2020-10-26 09:37:41,989 Warning: libqrencode not found
2020-10-26 09:37:42,988  keyboard settings: layout=us
2020-10-26 09:37:42,992  desktop size is 1600x900 with 1 screen:
2020-10-26 09:37:42,994   Default (423x238 mm - DPI: 96x96) workarea: 1600x860
2020-10-26 09:37:42,995     Generic PnP Monitor (309x174 mm - DPI: 131x131)
2020-10-26 09:37:51,050 enabled remote logging
2020-10-26 09:37:51,054 Xpra GTK3 X11 server version 3.0.12-r27620 64-bit
2020-10-26 09:37:51,055  running on Linux Ubuntu 16.04 xenial
(xpra_cmd:12680): Pango-WARNING **: 09:37:52.349: couldn't load font "Bitstream Vera Sans Not-Rotated 14.662109375", falling back to "Sans Not-Rotated 14.662109375", expect ugly output.

After that, terminal points to a very deep path; not at all ~


Mon, 26 Oct 2020 13:28:37 GMT - Antoine Martin:

TIL:

"Xpra-Python3-x86_64_4.1-r27735\xpra_cmd" start ssh://user@ip/4 --start=gnome-terminal

The path that you get when starting over ssh is the path that was recorded in run-xpra (usually found in $XDG_RUNTIME_DIR/xpra/run-xpra). This script is generated if missing when you run xpra initenv, and re-generated every time you start a new server.

r27794 changes the default order so that we will try to run xpra before trying $XDG_RUNTIME_DIR/xpra/run-xpra with ssh connections. (client-side change) This may well break someone's workflow / expectations, so I am not going to backport this in a hurry.


Mon, 26 Oct 2020 13:49:20 GMT - stdedos:

Nice catch.

In the $XDG_RUNTIME_DIR/xpra/run-xpra, I see twice the offending path:

Once in the PWD='/x/y/z' form and once in the form of:

cd '/x/y/z'
_XPRA_PYTHON=...
_XPRA_SCRIPT=...
...

In that script


Sat, 23 Jan 2021 05:57:20 GMT - migration script:

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