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_py_compile fails with OSError on FreeBSD for root user
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, christian.heimes, python-dev
Priority: normal Keywords: patch

Created on 2013-10-25 05:33 by Claudiu.Popa, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_py_compile.patch Claudiu.Popa, 2013-10-25 05:33 review
Messages (5)
msg201204 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2013-10-25 05:33
The actual error:

======================================================================
FAIL: test_exceptions_propagate (test.test_py_compile.PyCompileTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tank/libs/cpython/Lib/test/test_py_compile.py", line 88, in test_exceptions_propagate
    py_compile.compile(self.source_path, self.pyc_path)
AssertionError: OSError not raised

----------------------------------------------------------------------
Ran 7 tests in 0.007s

FAILED (failures=1)
test test_py_compile failed
1 test failed:
    test_py_compile

os.chmod(self.directory, stat.S_IREAD) doesn't do what it is expected on FreeBSD for root user, the attached patch skips this test if the current user is root.
msg201211 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-25 06:45
The patch looks good to me.

I'm curious, is a root user on FreeBSD allowed to create files inside a read-only directory?
msg201213 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2013-10-25 06:50
Yes, you can create files in a read-only directory if you are root, that's why os.chmod(directory, stat.S_IREAD is redundant there.
msg201216 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-25 07:22
New changeset e7b97822110f by Christian Heimes in branch 'default':
Issue 19384: Fix test_py_compile for root user, patch by Claudiu Popa.
http://hg.python.org/cpython/rev/e7b97822110f
msg201217 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-25 07:23
The test also fails for root user on Linux:

$ sudo ./python Lib/test/test_py_compile.py 
.....F.
======================================================================
FAIL: test_exceptions_propagate (__main__.PyCompileTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_py_compile.py", line 92, in test_exceptions_propagate
    py_compile.compile(self.source_path, self.pyc_path)
AssertionError: OSError not raised
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63583
2013-10-25 07:23:33christian.heimessetstatus: open -> closed
resolution: fixed
messages: + msg201217

stage: patch review -> resolved
2013-10-25 07:22:23python-devsetnosy: + python-dev
messages: + msg201216
2013-10-25 06:50:04Claudiu.Popasetmessages: + msg201213
2013-10-25 06:45:07christian.heimessetnosy: + christian.heimes
messages: + msg201211

type: behavior
stage: patch review
2013-10-25 05:33:48Claudiu.Popacreate