selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: Nicolas Iooss <nicolas.iooss@m4x.org>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH 1/4] libselinux: compile Python bytecode when installing Python files
Date: Sat, 2 Nov 2019 21:18:43 +0100	[thread overview]
Message-ID: <20191102211843.70b6037f@windsurf.home> (raw)
In-Reply-To: <20191102172812.22492-1-nicolas.iooss@m4x.org>

Hello Nicolas,

On Sat,  2 Nov 2019 18:28:09 +0100
Nicolas Iooss <nicolas.iooss@m4x.org> wrote:

> When selinux module is imported from a Python script, the content of
> __init__.py is compiled into bytecode and the result is saved into a
> file if it is allowed. For example, when root runs with Python 3.7 a
> script that uses "import selinux" on a system where SELinux is in
> permissive mode, this file may be created:
> 
>     /usr/lib/python3.7/site-packages/selinux/__pycache__/__init__.cpython-37.pyc
> 
> Prevent this file from being dynamically created by creating it when
> libselinux is installed, using "python -m compileall".
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

As far as I know, this not typically done by "setup.py install", and
this is generally left to distributions.

In the context of Buildroot [1], we do the byte-compilation all at once
at the very end of the build of all packages. Having individual
packages do their own byte-compilation would be annoying.

If you would like to have this byte-compilation done by the SELinux
Makefile, could you make it optional (even if you decide to enable it
by default) ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2019-11-02 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02 17:28 [PATCH 1/4] libselinux: compile Python bytecode when installing Python files Nicolas Iooss
2019-11-02 17:28 ` [PATCH 2/4] libsemanage: " Nicolas Iooss
2019-11-02 17:28 ` [PATCH 3/4] python: " Nicolas Iooss
2019-11-02 17:28 ` [PATCH 4/4] gui: " Nicolas Iooss
2019-11-02 20:18 ` Thomas Petazzoni [this message]
2019-11-03 20:57   ` [PATCH 1/4] libselinux: " Nicolas Iooss
2019-11-09 15:55     ` Nicolas Iooss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191102211843.70b6037f@windsurf.home \
    --to=thomas.petazzoni@bootlin.com \
    --cc=nicolas.iooss@m4x.org \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).