Bug 5985 - tl-setup calls checks/init functions in different orders in GUI and text mode
Summary: tl-setup calls checks/init functions in different orders in GUI and text mode
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Misc (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.13.0
Assignee: Pierre Ossman
URL:
Keywords: prosaic, samuel_tester
Depends on:
Blocks: 5980
  Show dependency treegraph
 
Reported: 2016-09-12 09:57 CEST by Peter Åstrand
Modified: 2021-08-24 12:29 CEST (History)
4 users (show)

See Also:
Acceptance Criteria:


Attachments
packages installed by tl-setup (5.93 KB, application/octet-stream)
2021-08-24 09:45 CEST, Samuel Mannehed
Details

Description Peter Åstrand cendio 2016-09-12 09:57:45 CEST
Problem found during work on bug 5828. Apparently, in GUI mode, tl-setup calls the "init" function of a certain module very early, before any other functions. However, in text mode, the "checks" are executed first, then the init function. This means that some code might fail. As of writing, the latest version of lsb.py (r31638) is broken on GUI mode due to this problem.
Comment 2 Pierre Ossman cendio 2016-09-19 10:34:58 CEST
Actually, "init" is a package installer thing and not something fundamental in tl-setup. It does however end up being called at different times because of how tl-setup works:

 - In GUI mode the module handler is expected to register its GUI elements, and hence every module is called right at the start.

 - In text mode there is no need to register things beforehand, so the handler is called when it is its turn and can do the interaction right away.

The problem occurs because the package installer calls the init function right away[1], rather than when it is time to do something. We could have it trigger on display instead, or update the package list after the check has been run.

[1] Which is odd, why not just have the result as an argument in that case?
Comment 6 Pierre Ossman cendio 2021-07-20 12:43:16 CEST
Should be restructured properly now. Actual effects are tested on bug 5980.

However, I've tested here that everything otherwise still works. Tested tl-setup on RHEL 8 and Ubuntu 20.04:

Ubuntu 20.04:

 - ghostscript
 - libnss3
 - libnspr4
 - nfs-common
 - python3-ldap

RHEL 8:

 - xauth
 - libX11
 - ghostscript
 - nss
 - nspr
 - postfix
 - nfs-utils
 - python3-gobject
 - gtk3
 - python3-ldap
 - selinux-policy-devel
Comment 7 William Sjöblom cendio 2021-08-13 16:18:32 CEST
The fix for this bug restructures much of user interface code for package
installation in tl-setup. We thus need to test *at least* these two
scenarios:

1. That tl-setup correctly installs all required packages
2. That tl-setup does not ask about installing packages that are already
   installed

The testing is to be performed in both GUI- and text-mode.
Comment 8 William Sjöblom cendio 2021-08-16 11:28:21 CEST
tl-setup crashes on openSuSE Leap 15.3 with the following stack trace during the GTK step:

> 2021-08-16 09:43:34,826: Traceback (most recent call last):
> 2021-08-16 09:43:34,826:   File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 303, in <module>
> 2021-08-16 09:43:34,826:     oOoO00 ( )
> 2021-08-16 09:43:34,826:   File "/opt/thinlinc/sbin/../libexec/tl-setup.py", line 259, in oOoO00
> 2021-08-16 09:43:34,827:     I11 = O00oOoo0 . run ( )
> 2021-08-16 09:43:34,827:   File "/opt/thinlinc/modules/thinlinc/wizard.py", line 99, in run
> 2021-08-16 09:43:34,827:     return self . _run_text ( )
> 2021-08-16 09:43:34,827:   File "/opt/thinlinc/modules/thinlinc/wizard.py", line 117, in _run_text
> 2021-08-16 09:43:34,827:     Oo0O0o0oO000 ( )
> 2021-08-16 09:43:34,827:   File "/opt/thinlinc/modules/thinlinc/tlsetup/requirements.py", line 191, in <lambda>
> 2021-08-16 09:43:34,827:     i1ii1 )
> 2021-08-16 09:43:34,827:   File "/opt/thinlinc/modules/thinlinc/tlsetup/pkginsthelp.py", line 61, in generic_text_installer
> 2021-08-16 09:43:34,827:     o0O0ooOoo00o = IIii . run ( )
> 2021-08-16 09:43:34,827:   File "/opt/thinlinc/modules/thinlinc/tlsetup/pkginsthelp.py", line 420, in run
> 2021-08-16 09:43:34,827:     if IiIi1I11I is None or len ( Ooo000oo0O00o ) == 0 :
> 2021-08-16 09:43:34,828: TypeError: object of type 'NoneType' has no len()

This is a regression.
Comment 11 William Sjöblom cendio 2021-08-16 17:14:57 CEST
I have tested the fix (Jenkins server build #2248) for the issue highlighted
in comment 8:

- [4/4] Ubuntu 20.04 LTS
  - [X] Running graphical tl-setup on a fresh system
  - [X] Running text-mode tl-setup on a fresh system
  - [X] Rerunning graphical tl-setup after all dependencies have already been
    installed
  - [X] Rerunning text-mode tl-setup after all dependencies have already been
    installed
- [4/4] openSUSE Leap 15.3
  - [X] Running graphical tl-setup on a fresh system
  - [X] Running text-mode tl-setup on a fresh system
  - [X] Rerunning graphical tl-setup after all dependencies have already been
    installed
  - [X] Rerunning text-mode tl-setup after all dependencies have already been
    installed

Marking as resolved.
Comment 12 Frida Flodin cendio 2021-08-18 09:17:23 CEST
The issue in comment #8 could in theory happen in GUI mode also, but looking at the code this seems to have been missed. This was not found in the testing since the package that triggered the issue was GTK+. You need to manually install that to run GUI mode in the first place, thus circumvent the problem.
Comment 13 William Sjöblom cendio 2021-08-18 09:43:48 CEST
Ok, so apparently we have another crash in the GUI code.

Steps to reproduce:
1. Start a minimal openSUSE Leap 15.3 machine
2. Install gnome =sudo zypper install -t pattern gnome_basic=
3. Remove ghostscript =sudo zypper remove ghostscript=
4. Install a recent build of the ThinLinc server
5. Run tl-setup in GUI-mode and we will crash on "Library and binary requirements"
Comment 15 William Sjöblom cendio 2021-08-18 10:17:08 CEST
The issue has now been fixed.
Comment 16 Samuel Mannehed cendio 2021-08-24 09:45:11 CEST
Created attachment 987 [details]
packages installed by tl-setup

Looks good. I tested both text and GUI mode on OpenSUSE Leap 15.3, Fedora 34, RHEL 7 and Ubuntu 18.04. The packages that were installed looked sane. I created an attachment that shows all the installed packages on these distros.
Comment 17 Samuel Mannehed cendio 2021-08-24 12:29:59 CEST
Used the tl-4.13.0rc2 server for testing.

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