hplip can leave python bytecode files not tracked by the package manager

Bug #1843100 reported by Chris Billington
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
New
Undecided
Unassigned

Bug Description

Hplip installs python modules in its directory (and not in the regular python site-packages directory). Because these are not installed by distutils or similar, the modules are not compiled to python bytecode. However, as soon as they are imported by code running as root, Python byte-compiles them and creates .pyc files in the filesystem. Since hplip tools are intended to be run as root, this occurs with normal use.

The resulting .pyc files are not tracked by the package manager, so they remain on the system if hplip is uninstalled.

A solution is to byte-compile the modules at build time, producing both optimised and non-optimised bytecode to cover all bases:

python -O -m compileall -d / <directory containing the python modules>
python -m compileall -d / <directory containing the python modules>

(or python3 instead of python)

This does make the build specific to a minor version of Python, so distros will still have to rebuild when they start shipping a new Python.

See also discussion on the Arch Linux bugtracker here:

https://bugs.archlinux.org/task/61329

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.