Bug 3846 - errors/log entries when runtime compiling python files
Summary: errors/log entries when runtime compiling python files
Status: ASSIGNED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Server Installer (show other bugs)
Version: 3.1.2
Hardware: PC All
: P2 Normal
Target Milestone: MediumPrio
Assignee: Peter Åstrand
URL:
Keywords:
: 5565 5977 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-27 10:06 CEST by Pierre Ossman
Modified: 2019-05-21 12:48 CEST (History)
2 users (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2011-06-27 10:06:43 CEST
We have a lot of Python stuff that are used in contexts where the compiled bytecode cannot be written back to disk. Most commonly this happens when normal users run some ThinLinc command, but it can also happen from some daemons (e.g. cupsd) and/or as the result of SELinux or AppArmor.

The issue this causes is:

a) Annoying log messages here and there, most notably when we hit a SELinux restriction as that also pops up a graphical notification.

b) Python (at least some version) is a stupid bastard and loads the .pyc even when it could not write to it. That means that if a ThinLinc component gets updated, normal users won't start using the new code until an unrestricted user loads that particular .py.


We could solve this by having tl-setup precompiling everything. Might also be possible to work around it using -B in relevant scripts.
Comment 1 Pierre Ossman cendio 2012-02-07 13:12:25 CET
Need to check:

 - Does solaris support flags in the hash-bang? Can we turn of compilation files from within python?

 - What's the performance hit of not having .pyc files? E.g. the VDI module is rather big.
Comment 2 Pierre Ossman cendio 2012-02-09 13:55:01 CET
Python documentation states that the feature to disable .pyc generation wasn't added until 2.6. :/

Python 3.0 takes a new approach:

http://docs.python.org/dev/whatsnew/3.2.html#pep-3147-pyc-repository-directories
Comment 3 Peter Åstrand cendio 2012-03-06 09:13:32 CET
(In reply to comment #0)

> b) Python (at least some version) is a stupid bastard and loads the .pyc even
> when it could not write to it. That means that if a ThinLinc component gets
> updated, normal users won't start using the new code until an unrestricted user
> loads that particular .py.

Need proof, haven't been able to reproduce. Also searched the Python bug DB. The docs are also pretty clear: http://docs.python.org/tutorial/modules.html#compiled-python-files:

"The modification time of the version of spam.py used to create spam.pyc is recorded in spam.pyc, and the .pyc file is ignored if these don’t match."
Comment 4 Peter Åstrand cendio 2012-03-06 10:48:55 CET
(In reply to comment #0)

> a) Annoying log messages here and there, most notably when we hit a SELinux
> restriction as that also pops up a graphical notification.

Failed to reproduce this on RHEL6, even after manually installing:

setroubleshoot-plugins.noarch setroubleshoot.x86_64 setroubleshoot-server.x86_64 

Since this is a non critical bug, we'll postpone it. Also, we need more information about if this is really a problem worth solving.
Comment 5 Pierre Ossman cendio 2014-02-27 11:30:54 CET
(In reply to comment #4)
> (In reply to comment #0)
> 
> > a) Annoying log messages here and there, most notably when we hit a SELinux
> > restriction as that also pops up a graphical notification.
> 
> Failed to reproduce this on RHEL6, even after manually installing:
> 

Happens on a default install of Fedora 20. When installing the printer queues, cupsd will try to create lowxmlrpc.pyc, which it isn't allowed to do.

Since nothing else will have had an opportunity to create this file earlier, this will happen for more or less every Fedora user that tries out ThinLinc.
Comment 6 Pierre Ossman cendio 2015-06-09 13:41:13 CEST
*** Bug 5565 has been marked as a duplicate of this bug. ***
Comment 7 Pierre Ossman cendio 2016-09-07 12:48:11 CEST
*** Bug 5977 has been marked as a duplicate of this bug. ***

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