Bug 7492 - Profile chooser crashes if pygtk isn't available
Summary: Profile chooser crashes if pygtk isn't available
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Misc (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.12.0
Assignee: Samuel Mannehed
URL:
Keywords: ossman_tester, prosaic
Depends on:
Blocks:
 
Reported: 2020-05-06 11:22 CEST by Samuel Mannehed
Modified: 2020-06-02 09:49 CEST (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Samuel Mannehed cendio 2020-05-06 11:22:45 CEST
When pygtk isn't available for Python 2 the profile chooser crashes:

> Traceback (most recent call last):
>   File "/opt/thinlinc/libexec/tl-run-xstartup-feedback", line 11, in
> <module>
>     import gtk
> ImportError: No module named gtk

In the case when only one profile is available, and the intro text shouldn't show, we don't need to display anything, and in this case we shouldn't need pygtk.

This is a regression from commit r34241 for bug 7329, and has been broken since ThinLinc 4.10.1.

Reproduced the bug on RHEL8 by removing pygtk2.
Comment 2 Samuel Mannehed cendio 2020-05-06 12:45:43 CEST
The same problem exists for tl-run-xstartup-feedback:

> Traceback (most recent call last):
>   File "/opt/thinlinc/libexec/tl-run-xstartup-feedback", line 11, in <module>
>     import gtk
> ImportError: No module named gtk
Comment 4 Samuel Mannehed cendio 2020-05-06 12:50:51 CEST
The issue with the crashes should be fixed now. However, before closing this bug we should probably write some automatic tests covering this. That should help make sure this isn't missed again in the future.
Comment 5 Pierre Ossman cendio 2020-05-25 10:41:27 CEST
I've checked the code and unfortunately the current structure does not suit itself for easy automatic testing. The program has a lot of dependencies on external things, making it difficult to set up an environment where it can be unit tested.

This is also an uncommon corner case (with a temporary peak right now as we migrate to Python 3), so I don't think it is appropriate to add it to our functional tests.

What we can do though is add a packaging test that finds files that try to import PyGTK directly.
Comment 7 Pierre Ossman cendio 2020-05-28 14:32:05 CEST
Can confirm this happens on RHEL 8:

> 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 12, in <module>
>     import gtk

At which point the session just terminates.

After an upgrade to a nightly build it properly continues with the first profile found, and the log is much nicer:

> /opt/thinlinc/libexec/tl-run-xstartup-feedback: warning: Unable to import GTK module
> /opt/thinlinc/libexec/tl-run-xstartup-feedback: warning: Won't present xstartup.d feedback
> ...
> Running /opt/thinlinc/etc/xstartup.d/20-tl-select-profile.sh (Choosing a profile)
> /opt/thinlinc/libexec/tl-select-profile: warning: Unable to import GTK module
> /opt/thinlinc/libexec/tl-select-profile: warning: Can't show introduction text
> /opt/thinlinc/libexec/tl-select-profile: warning: Using first available profile as fallback

Once I install PyGTK again the profile chooser seems to work just fine.

However the startup feedback is broken:

> Traceback (most recent call last):
>   File "/opt/thinlinc/libexec/tl-run-xstartup-feedback", line 124, in <module>
>     II111iiiiII ( )
>   File "/opt/thinlinc/libexec/tl-run-xstartup-feedback", line 98, in II111iiiiII
>     O00o = tlgtk . gtk . Throbber ( )
Comment 8 Samuel Mannehed cendio 2020-06-01 14:40:21 CEST
However the startup feedback is broken:

> Traceback (most recent call last):
>   File "/opt/thinlinc/libexec/tl-run-xstartup-feedback", line 124, in <module>
>     II111iiiiII ( )
>   File "/opt/thinlinc/libexec/tl-run-xstartup-feedback", line 98, in II111iiiiII
>     O00o = tlgtk . gtk . Throbber ( )

Fixed in r35047
Comment 10 Pierre Ossman cendio 2020-06-02 09:49:26 CEST
I can confirm that the startup feedback now works fine.

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