Skip to content

Commit 947aa70

Browse files
[3.13] gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369) (#150703)
gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369) (cherry picked from commit 9d64c35) Co-authored-by: Dawid Konrad Kohnke <51542233+anytokin@users.noreply.github.com>
1 parent cbbddff commit 947aa70

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/test/test_tempfile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ def test_read_only_directory(self):
336336
with _inside_empty_temp_dir():
337337
probe = os.path.join(tempfile.tempdir, 'probe')
338338
if os.name == 'nt':
339-
cmd = ['icacls', tempfile.tempdir, '/deny', 'Everyone:(W)']
339+
# Use security identifier *S-1-1-0 instead
340+
# of localized "Everyone" to not depend on the locale.
341+
cmd = ['icacls', tempfile.tempdir, '/deny', '*S-1-1-0:(W)']
340342
stdout = None if support.verbose > 1 else subprocess.DEVNULL
341343
subprocess.run(cmd, check=True, stdout=stdout)
342344
else:
@@ -359,7 +361,9 @@ def test_read_only_directory(self):
359361
self.make_temp()
360362
finally:
361363
if os.name == 'nt':
362-
cmd = ['icacls', tempfile.tempdir, '/grant:r', 'Everyone:(M)']
364+
# Use security identifier *S-1-1-0 instead
365+
# of localized "Everyone" to not depend on the locale.
366+
cmd = ['icacls', tempfile.tempdir, '/grant:r', '*S-1-1-0:(M)']
363367
subprocess.run(cmd, check=True, stdout=stdout)
364368
else:
365369
os.chmod(tempfile.tempdir, oldmode)

0 commit comments

Comments
 (0)