Bug 5819 - tl-desktop-activate.sh crashes if broken symlink
Summary: tl-desktop-activate.sh crashes if broken symlink
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Misc (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Peter Åstrand
Depends on:
Reported: 2016-03-17 08:56 CET by Peter Åstrand
Modified: 2016-03-22 10:13 CET (History)
1 user (show)

See Also:
Acceptance Criteria:


Description Peter Åstrand cendio 2016-03-17 08:56:53 CET
If there's a broken symlink in .config/menus, tl-desktop-activate.sh will crash:

$ sh -x 
+ ID='id -u'
++ id -u
+ '[' 1028 -ne 0 ']'
+ /opt/thinlinc/bin/tl-desktop-builder
Traceback (most recent call last):
   File "/opt/thinlinc/bin/tl-desktop-builder", line 63, in <module>
     write_menu ( II , ooo0Oo0 )
   File "/opt/thinlinc/modules/thinlinc/tl_desktop/apps.py", line 202, 
in write_menu
     os . symlink ( iiIIiIiIi , Ii1iIiii1 ) ;
OSError: [Errno 17] File exists
+ rm -f /var/tmp/kdecache-bobby/ksycoca
+ rm -f /var/tmp/kdecache-bobby/ksycoca4

This is due to this code:

        if os.path.exists(mfsl):
        os.symlink(menufile, mfsl);

But os.path.exists returns False for broken symlinks:

>>> os.path.exists.__doc__
'Test whether a path exists.  Returns False for broken symbolic links'

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