Repository navigation
Report writers: published files get the umask's bits, not mkstemp's 0600 - #1082
Conversation
awc_manifest, rsc8_audio and classify_carve stage their report in a 0600 temp file and os.replace it, so on POSIX the report ended up 0600. rbf0_tree had its own copy of the umask(0)/umask(mask) read that file_mode replaced (ItsNotRexed#750). All four now use file_mode.published_mode, and tests/test_file_mode.py covers them with the other writers.
|
Tested a1c943f on Linux (WSL2 Ubuntu), Python 3.12, CPU only: pass
One more writer with the same 0600 problem, not covered here: |
|
Tested a1c943f on Windows: pass. Windows 11 Home 10.0.26300, Python 3.14.7 (numpy 2.5.5, pytest 9.2.0 in a venv).
AI-assisted (Claude Code). No game files. |
awc_manifest.py,rsc8_audio.pyandclassify_carve.pywrite their reports to amkstemp/NamedTemporaryFilefile andos.replaceit into place. Those temp files are created 0600, so on POSIX a new report ended up 0600 instead of the umask's bits (0644 with umask 022).rbf0_tree.pydid chmod, but its_report_modestill read the umask withos.umask(0)/os.umask(mask). That briefly sets mask 0 for every thread, which is whattools/file_mode.pyreplaced inglb_writerandrtti_scan(#750, #866).All four now call
file_mode.published_mode(path)beforeos.replace: a replaced report keeps its bits, and a new one gets whatopen()would give it.rbf0_tree._report_modeis removed.mainos.umask(0)Test: the four writers join
glb_writerandrtti_scanintests/test_file_mode.py's writer list.test_writes_never_call_umaskfails onmainon Windows and POSIX (rbf0_treecallsos.umask). On POSIX (WSL, Python 3),test_new_file_mode_follows_the_current_umaskalso fails onmain(0600 != 0664). Both pass with this change. The related test files (test_rbf0_tree,test_awc_manifest,test_rsc8_audio,test_classify_carve) pass on Windows and WSL.AI-assisted.