-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
test_pathlib assumes underlying filesystem permits creation with world-write permissions #85633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Two tests in test_pathlib test that the files created have mode o666 (rw-rw-rw). However, on a filesystem (in my case NFS) configured to never permit global write - the test will always fail. Is this something to be concerned about? I can think of a few possible ways to react to an exception such as this, e.g., rather than 'FAIL' outright, try umask(2). ++++++++ Traceback (most recent call last):
File "/data/prj/python/src/py38-3.8.5/Lib/test/test_pathlib.py", line 2210, in test_open_mode
self.assertEqual(stat.S_IMODE(st.st_mode), 0o666)
AssertionError: 436 != 438 ====================================================================== Traceback (most recent call last):
File "/data/prj/python/src/py38-3.8.5/Lib/test/test_pathlib.py", line 2223, in test_touch_mode
self.assertEqual(stat.S_IMODE(st.st_mode), 0o666)
AssertionError: 436 != 438 ++++++++ Just to verify it does work when on a 'local' filesystem. cp -rp build /tmp/build == Tests result: SUCCESS == 1 test OK. Total duration: 7.8 sec |
umask(0o002) looks good idea (and perhaps umask(0o026) instead of umask(0o022)). Please add also a short explanation comment. |
…d-write. Replace `umask(0)` with `umask(2)`, and `umask(0o022)` with `umask(0o026)`, so the created files are not world-writable. In the latter case, we remove read permission to check that permissions for 'others' can still be set.
…d-write. Replace `umask(0)` with `umask(2)` so the created files are not world-writable, and replace `umask(0o022)` with `umask(0o026)` to check that permissions for 'others' can still be set.
…e. (#122883) Replace `umask(0)` with `umask(0o002)` so the created files are not world-writable, and replace `umask(0o022)` with `umask(0o026)` to check that permissions for 'others' can still be set.
…d-write. (pythonGH-122883) Replace `umask(0)` with `umask(0o002)` so the created files are not world-writable, and replace `umask(0o022)` with `umask(0o026)` to check that permissions for 'others' can still be set. (cherry picked from commit 5f68511) Co-authored-by: Barney Gale <barney.gale@gmail.com>
…ld-write. (GH-122883) (#122979) GH-85633: Fix pathlib test failures on filesystems without world-write. (GH-122883) Replace `umask(0)` with `umask(0o002)` so the created files are not world-writable, and replace `umask(0o022)` with `umask(0o026)` to check that permissions for 'others' can still be set. (cherry picked from commit 5f68511) Co-authored-by: Barney Gale <barney.gale@gmail.com>
Sorted. Thanks Serhiy for the suggestion and review. |
…d-write. (python#122883) Replace `umask(0)` with `umask(0o002)` so the created files are not world-writable, and replace `umask(0o022)` with `umask(0o026)` to check that permissions for 'others' can still be set.
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: