[issue41461] test_pathlib assumes underlying filesystem permits creation with world-write permissions

2021-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

umask(0o002) looks good idea (and perhaps umask(0o026) instead of 
umask(0o022)). Please add also a short explanation comment.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41461] test_pathlib assumes underlying filesystem permits creation with world-write permissions

2020-08-03 Thread Michael Felt


New submission from Michael Felt :

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).



==
FAIL: test_open_mode (test.test_pathlib.PosixPathTest)
--
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

==
FAIL: test_touch_mode (test.test_pathlib.PosixPathTest)
--
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
mv build build.nfs
ln -s /tmp/build build

== Tests result: SUCCESS ==

1 test OK.

Total duration: 7.8 sec
Tests result: SUCCESS

--
components: Tests
messages: 374725
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: test_pathlib assumes underlying filesystem permits creation with 
world-write permissions
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com