Bug 7899 - Malformed .desktop file will cause TLDC to crash
Summary: Malformed .desktop file will cause TLDC to crash
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: TLDC (Desktop Customizer) (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: MediumPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-25 09:06 CEST by Martin Östlund
Modified: 2022-04-26 14:15 CEST (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Martin Östlund cendio 2022-04-25 09:06:25 CEST
If a .desktop file contains a line that does not have a key=value, # or [ as leading characters TLDC will crash with a stacktrace in tlwebadm.log:


> code 500, message Internal error on page '/desktop/'
> 'GET /desktop/ HTTP/1.1' 500 -
> ----------------------------------------
> Traceback (most recent call last):
>   File "/opt/thinlinc/modules/thinlinc/xdg/IniFile.py", line 77, in parse
>     key, value = line.split("=", 1)
> ValueError: not enough values to unpack (expected 2, got 1)
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/opt/thinlinc/modules/thinlinc/tlwebadm/server.py", line 162, in post_or_get
>     OooO0O00o0 , OOo = getattr ( IIiII11I , action ) ( I11ii1IiIii , query , OooO0O00o0 )
>   File "/opt/thinlinc/modules/thinlinc/tlwebadm/main.py", line 130, in do_GET
>     self . _GET_METHODS . get ( page_name , self . error_404 ) ( query ) )
>   File "/opt/thinlinc/modules/thinlinc/tlwebadm/desktop.py", line 74, in home
>     selfdefined = False ) )
>   File "/opt/thinlinc/modules/thinlinc/tl_desktop/apps.py", line 64, in get_applications
>     ii1Ii ( i11IiIIiii1II , o00 , i11IiIIiii1II )
>   File "/opt/thinlinc/modules/thinlinc/tl_desktop/apps.py", line 45, in ii1Ii
>     I1i = i1ii1 ( basedir , os . path . join ( oOoo0 , Iio0 ) )
>   File "/opt/thinlinc/modules/thinlinc/tl_desktop/apps.py", line 27, in __init__
>     self . parse ( self . path )
>   File "/opt/thinlinc/modules/thinlinc/xdg/DesktopEntry.py", line 49, in parse
>     IniFile.parse(self, file, ["Desktop Entry", "KDE Desktop Entry"])
>   File "/opt/thinlinc/modules/thinlinc/xdg/IniFile.py", line 79, in parse
>     raise ParsingError("Invalid line: " + line, filename)
> thinlinc.xdg.Exceptions.ParsingError: ParsingError in file '/usr/share/applications/screensavers/cosmos-slideshow.desktop', Invalid line: asd
> ----------------------------------------

In the browser the admin will see:

> Error response
> Error code: 500

> Message: Internal error on page '/desktop/'.

> Error code explanation: 500 - Server got itself in trouble.

We should probably handle this a bit more graceful and not serve a HTTP 500 which is far from user friendly.
Comment 1 Martin Östlund cendio 2022-04-26 14:15:28 CEST
This problem was reported by a user on the community,
https://community.thinlinc.com/t/web-customizer-server-error/353/13

The file in question that gave the problem was /usr/share/applications/screensavers/glitchpeg.desktop that comes from the package xscreensaver-data-extra

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