[issue6070] Pyhon 2.6 makes .pyc/.pyo bytecode files executable

Joe Amenta report at bugs.python.org
Fri May 22 21:54:03 CEST 2009


Joe Amenta <amentajo at msu.edu> added the comment:

Python writes compiled files with the same file permissions as the
source module.  In your specific example:

$ python2.6 -c 'import module'

This will produce module.pyc with the same attributes as module.py

While I am not familiar with modifying C stat structs, I can say that in
trunk/Python/import.c, somewhere after line 977 but before line 1014,
the stat struct "st" must be examined for S_IXUSR, S_IXGRP, and S_IXOTH
and have those bits removed in order to never produce a compiled module
with "x" in the stat.  I would assign low priority to this issue, as it
has little impact on the behavior of Python, even though it might cause
unintended consequences to a user trying to execute the bytecode, if the
user interprets the "x" to mean that it is executable by the system.

----------
nosy: +joe.amenta

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6070>
_______________________________________


More information about the Python-bugs-list mailing list