Skip to content

Commit c99afe8

Browse files
[3.14] gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369) (#150702)
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 893dd4d commit c99afe8

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
@@ -332,7 +332,9 @@ def test_read_only_directory(self):
332332
with _inside_empty_temp_dir():
333333
probe = os.path.join(tempfile.tempdir, 'probe')
334334
if os.name == 'nt':
335-
cmd = ['icacls', tempfile.tempdir, '/deny', 'Everyone:(W)']
335+
# Use security identifier *S-1-1-0 instead
336+
# of localized "Everyone" to not depend on the locale.
337+
cmd = ['icacls', tempfile.tempdir, '/deny', '*S-1-1-0:(W)']
336338
stdout = None if support.verbose > 1 else subprocess.DEVNULL
337339
subprocess.run(cmd, check=True, stdout=stdout)
338340
else:
@@ -355,7 +357,9 @@ def test_read_only_directory(self):
355357
self.make_temp()
356358
finally:
357359
if os.name == 'nt':
358-
cmd = ['icacls', tempfile.tempdir, '/grant:r', 'Everyone:(M)']
360+
# Use security identifier *S-1-1-0 instead
361+
# of localized "Everyone" to not depend on the locale.
362+
cmd = ['icacls', tempfile.tempdir, '/grant:r', '*S-1-1-0:(M)']
359363
subprocess.run(cmd, check=True, stdout=stdout)
360364
else:
361365
os.chmod(tempfile.tempdir, oldmode)

0 commit comments

Comments
 (0)