This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_compileall fails when run by unprivileged user on installed Python
Type: behavior Stage: resolved
Components: Tests, Windows Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: benjamin.peterson, brett.cannon, eric.snow, georg.brandl, ncoghlan, paul.moore, python-dev, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2015-09-14 04:32 by zach.ware, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue25099.diff brett.cannon, 2015-09-25 20:52 review
issue25099.diff brett.cannon, 2015-10-09 19:46 review
issue25099.diff brett.cannon, 2015-10-09 21:19 review
Messages (15)
msg250614 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-09-14 04:32
======================================================================
FAIL: test_no_args_respects_force_flag (test.test_compileall.CommandLineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Program Files\Python 3.5\lib\test\test_compileall.py", line 229, in test_no_args_respects_force_flag
    self.assertRunOK('-f', PYTHONPATH=self.directory)
  File "C:\Program Files\Python 3.5\lib\test\test_compileall.py", line 179, in assertRunOK
    *self._get_run_args(args), **env_vars)
  File "C:\Program Files\Python 3.5\lib\test\support\script_helper.py", line 135, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "C:\Program Files\Python 3.5\lib\test\support\script_helper.py", line 121, in _assert_python
    err))
AssertionError: Process return code is 1
command line: ['C:\\Program Files\\Python 3.5\\python.exe', '-X', 'faulthandler', '-S', '-m', 'compileall', '-f']

stdout:
---
(... truncated stdout ...)rror: [Errno 13] Permission denied: 'C:\\Program Files\\Python 3.5\\lib\\__pycache__\\sre_compile.cpython-35.pyc.978608563184'
Compiling 'C:\\Program Files\\Python 3.5\\lib\\sre_constants.py'...

<output continues with many more lines like the above two>

No such problem on installed 3.4.3.
msg250633 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-14 06:25
The failure can be reproduced on Linux if make the Lib/__pycache__/ directory non-writable.
msg250690 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-09-14 17:34
IIRC there's an existing issue for this. (Or it may have just been mentioned in a "things that don't work when you're not root" list on an issue.)
msg250694 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-14 17:52
Existing issue21264 reports about failure of different test. It may be the same issue or different but related issues.
msg250697 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-09-14 18:02
It sounds like some tests just need to have a decorator that blocks execution if the relevant __pycache__ isn't writable.
msg251609 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-09-25 20:52
Here is a patch that should work. Can someone who has had the problem test it? It works in my limited testing but I want to make sure this solves it before I commit it.
msg251716 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-09-27 18:59
Added comments on Rietveld.
msg252640 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-10-09 19:46
Here is a new patch that addresses Serhiy's comments.
msg252658 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-10-09 21:08
Added new comments.
msg252663 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-10-09 21:19
I have addressed Serhiy's comments again.
msg252668 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-09 22:10
New changeset 34bbd537b3e6 by Brett Cannon in branch '3.5':
Issue #25099: Skip relevant tests in test_compileall when an entry on
https://hg.python.org/cpython/rev/34bbd537b3e6

New changeset 21f3a92e0c6d by Brett Cannon in branch 'default':
Merge for issue #25099
https://hg.python.org/cpython/rev/21f3a92e0c6d
msg252669 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-10-09 22:10
Thanks to Serhiy for all of the reviews!
msg252695 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-10-10 07:04
Do you want to backport the fix to 3.4 (and 2.7?)? Issue21264 was reported for 3.4.
msg252723 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-10-10 16:08
I feel I have already spent way too much time on this issue, but if you want to backport even further then feel free to.
msg252732 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-10 17:28
New changeset fc0a7aa7ae61 by Brett Cannon in branch '3.4':
Issue #25099: Skip relevant tests in test_compileall when an entry on
https://hg.python.org/cpython/rev/fc0a7aa7ae61
History
Date User Action Args
2022-04-11 14:58:20adminsetgithub: 69286
2015-10-14 15:57:50brett.cannonsetstatus: open -> closed
2015-10-10 17:28:45python-devsetmessages: + msg252732
2015-10-10 16:08:46brett.cannonsetmessages: + msg252723
2015-10-10 07:04:20serhiy.storchakasetmessages: + msg252695
2015-10-09 22:11:37brett.cannonlinkissue21264 superseder
2015-10-09 22:10:39brett.cannonsetresolution: fixed
messages: + msg252669
stage: commit review -> resolved
2015-10-09 22:10:18python-devsetnosy: + python-dev
messages: + msg252668
2015-10-09 21:19:56brett.cannonsetfiles: + issue25099.diff

messages: + msg252663
2015-10-09 21:08:34serhiy.storchakasetmessages: + msg252658
2015-10-09 19:46:51brett.cannonsetstage: patch review -> commit review
2015-10-09 19:46:43brett.cannonsetfiles: + issue25099.diff

messages: + msg252640
2015-09-27 18:59:14serhiy.storchakasetmessages: + msg251716
2015-09-25 20:52:46brett.cannonsetfiles: + issue25099.diff
keywords: + patch
messages: + msg251609

stage: needs patch -> patch review
2015-09-14 18:02:38brett.cannonsetmessages: + msg250697
2015-09-14 17:52:47serhiy.storchakasetmessages: + msg250694
2015-09-14 17:34:13steve.dowersetmessages: + msg250690
2015-09-14 17:14:51brett.cannonsetassignee: brett.cannon
2015-09-14 12:18:55serhiy.storchakalinkissue17750 dependencies
2015-09-14 06:30:08serhiy.storchakasetnosy: + brett.cannon, georg.brandl, ncoghlan, benjamin.peterson, eric.snow
2015-09-14 06:25:41serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg250633
2015-09-14 04:32:53zach.warecreate