Our pyxdg has not been updated from upstream in many years. It is also written for only Python 2.
There are two changes between the last vendor drop and thinlinc code: 1) A quick fix to handle empty <include> blocks in menu files. See bug 7381. 2) New functionality to make it easier to create and read Exec-value in .desktop files using an argument vector. This is done with two new functions in xdg.DesktopEntry: getExecArgv and setExecArgv. See bug 3570. By investigating the current upstream pyxdg v0.26, the conclusions are: 1) The empty <include> is handled in pyxdg v0.26 without our fix. In other words, no need for our quick fix anymore. 2) Our new functionality for handling Exec/Argv has no equivalent in pyxdg v0.26. Therefore a merge request is made to upstream with our changes and some new unittests: https://gitlab.freedesktop.org/xdg/pyxdg/-/merge_requests/6
I can verify that tests are being run by Jenkins, and that they are run for both Python 2 and Python 3. TLDC seems to read system .desktop files correctly. Creating new files however breaks: > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] code 500, message Internal error on page '/desktop/manapplications' > 2020-10-02 09:04:52 INFO tlwebadm[26906]: [::ffff:10.47.1.240] 'POST /desktop/manapplications HTTP/1.1' 500 - > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] ---------------------------------------- > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] Traceback (most recent call last): > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] File "/opt/thinlinc/sbin/tlwebadm", line 174, in post_or_get > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] I1i1I1II , Oo0O0O0ooO0O = getattr ( OOOoO0O0o , action ) ( o0O , query , I1i1I1II ) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] File "/opt/thinlinc/modules/thinlinc/tlwebadm/main.py", line 131, in do_POST > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] self . _POST_METHODS . get ( page_name , self . error_404 ) ( query ) ) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] File "/opt/thinlinc/modules/thinlinc/tlwebadm/desktop.py", line 85, in manapplications > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] return self . applications ( query , sysapps = False ) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] File "/opt/thinlinc/modules/thinlinc/tlwebadm/desktop.py", line 105, in applications > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] ( Oooo0000 [ 'errors' ] , Oooo0000 [ 'details' ] ) = self . save_application ( query ) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] File "/opt/thinlinc/modules/thinlinc/tlwebadm/desktop.py", line 329, in save_application > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] trusted = True ) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] File "/opt/thinlinc/modules/xdg/IniFile.py", line 331, in write > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] fp.write(u("%s=%s\n") % (key, value)) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128) > 2020-10-02 09:04:52 ERROR tlwebadm[26906]: [::ffff:10.47.1.240] ----------------------------------------
It seems like (at least) xdg/Config.py was overlooked when reverting the namespace changes. It still uses Python 2's dodgy imports.
Re-verified that tests are done by Jenkins, and that TLDC can read system .desktop files. Creating new applications seem to work fine, even with Unicode in the fields. I note that % gets escaped, but I think that is as intended. Menu entries are also properly created. Tested activation with MATE on Ubuntu 18.04 and looks like it works fine. Also checked that the profile chooser is correctly parsing things. It seems to pick up on all xsessions files properly, and it is setting $DESKTOP_SESSION, $XDG_DESKTOP_SESSION and $XDG_CURRENT_DESKTOP properly.
This upgrade breaks tl-select-profile (and tl-run-profile) if the user has any non-ASCII characters in their $PATH. One such scenario is if $HOME/bin is in $PATH and the user has a non-ASCII homedir (because the username is not ASCII). What you get is this crash: > Running /opt/thinlinc/etc/xstartup.d/20-tl-select-profile.sh (Choosing a profile) > Traceback (most recent call last): > File "/opt/thinlinc/libexec/tl-select-profile", line 465, in <module> > OO = O00O0O0O0 ( OOoOoo ) > File "/opt/thinlinc/libexec/tl-select-profile", line 124, in O00O0O0O0 > if not which ( oOOO00o ) : > File "/opt/thinlinc/modules/thinlinc/which.py", line 20, in which > iIiiiI = os . path . join ( o0OOO , app ) > File "/usr/lib64/python2.7/posixpath.py", line 73, in join > path += '/' + b > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128) The reason is that PyXDG now gives us a unicode string for the command in TryExec. And when we try to combine that with the str from os.environ['PATH'], then it first need to decode that str to unicode. Which then promptly fails as that default upgrade only supports ASCII. Not reopening bug as this is a temporary problem until the profile commands are also converted to Python 3, which will happen before the next release. It is also a corner case and doesn't affect most use.