Bug 4245 - our python modules shouldn't replace the system ones
Summary: our python modules shouldn't replace the system ones
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Other (show other bugs)
Version: 3.2.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.13.0
Assignee: Pierre Ossman
URL:
Keywords: prosaic, wilsj_tester
Depends on: 4586
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-29 16:17 CEST by Pierre Ossman
Modified: 2021-08-10 09:39 CEST (History)
2 users (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2012-03-29 16:17:34 CEST
Currently we put our python path as the first one in sys.path. This has several problems:

 a) We override the system modules, providing a different implementation than the system expects. This will eventually cause crashes.

 b) The module actually loaded is unpredictable. If the module gets loaded before we modify sys.path, then we get the system version. If it gets loaded later then we get our version. Since we don't know what other imports will load, the module actually loaded is somewhat random.


Putting our path at the end would mostly solve these issues. A portion of b) still remains though:

 c) Our code can't be sure we loaded our version of a module.

Solving this is non-trivial though...
Comment 1 Pierre Ossman cendio 2012-12-07 10:11:03 CET
The best idea so far is to move everything into a new namespace (e.g. under the "thinlinc" module). This will allow us to load our versions without conflicting with the system ones.

One potential problem though is that complex modules (e.g. Cheetah) do internal imports. We need to check that these work properly if we start moving things around.
Comment 2 Pierre Ossman cendio 2020-09-10 12:17:13 CEST
The things we have left are:

 * aes.py
 * Cheetah
 * hiveconf.py
 * mountclient
 * rpc.py
Comment 3 Linn cendio 2020-09-11 14:18:29 CEST
Cheetah does internal imports that can not be handled with Python 2. Therefore this bug must be done after the Python 3 conversion is done.
Comment 11 Pierre Ossman cendio 2021-07-21 15:33:24 CEST
Pull request/Merge request for upstream projects:

https://github.com/CheetahTemplate3/cheetah3/pull/46
https://gitlab.freedesktop.org/xdg/pyxdg/-/merge_requests/11
Comment 17 Pierre Ossman cendio 2021-07-22 13:42:20 CEST
Tested that the following still works on Ubuntu 20.04:

 - TLDC UI (in tlwebadm)
 - Mounting and unmounting local drives
 - Web Access login
 - Profile chooser/runner
Comment 21 Pierre Ossman cendio 2021-07-22 14:33:59 CEST
Everything* is now moved in to the thinlinc namespace. Hiveconf is imported basically everywhere, but I've tested the main bits:

 * All services start
 * tlwebadm works
 * tlwebaccess works
 * Login works
 * profile chooser works
 * tl-config works
 * tl-mount-localdrives works
 * tl-session-param works
 * thinlocal works
 * no errors in xinit.log


* Except sitecustomize.py, which must be in the root
Comment 22 William Sjöblom cendio 2021-08-10 09:39:47 CEST
Tested on a Fedora 33 machine running Jenkins server build #2244:

- [3/3] General tests
  - [X] Login works as expected.
  - [X] No errors in xinit.log.
  - [X] All affected imports are now made from thinlinc.X instead of X.
- [2/2] pyaes
  - [X] tl-sso-password works as intended.
  - [X] tl-sso-update-password works as intended.
- [2/2] pyxdg
  - [X] Profile chooser works as expected with GNOME/GNOME Classic installed.
  - [X] System applications correctly listed in tlwebadm.
- [1/1] mountclient/rpc
  - [X] Local drive redirection works as expected.
- [3/3] Cheetah 
  - [X] All Cheetah files intended for library use uses relative imports.
  - [X] All pages on tlwebadm render correctly.
  - [X] All pages on tlwebaccess render correctly.
- [2/2] hiveconf
  - [X] thinlocal works as expected.
  - [X] tl-config works as expected.

Note You need to log in before you can comment on or make changes to this bug.