Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6ec3b1

Browse files
committed
gh-118486: Simplify test_win32_mkdir_700 to check the exact ACL
1 parent7d8725a commitf6ec3b1

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

‎Lib/test/test_os.py‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,21 +1814,14 @@ def test_exist_ok_existing_regular_file(self):
18141814
@unittest.skipUnless(os.name=='nt',"requires Windows")
18151815
deftest_win32_mkdir_700(self):
18161816
base=os_helper.TESTFN
1817-
path1=os.path.join(os_helper.TESTFN,'dir1')
1818-
path2=os.path.join(os_helper.TESTFN,'dir2')
1819-
# mode=0o700 is special-cased to override ACLs on Windows
1820-
# There's no way to know exactly how the ACLs will look, so we'll
1821-
# check that they are different from a regularly created directory.
1822-
os.mkdir(path1,mode=0o700)
1823-
os.mkdir(path2,mode=0o777)
1824-
1825-
out1=subprocess.check_output(["icacls.exe",path1],encoding="oem")
1826-
out2=subprocess.check_output(["icacls.exe",path2],encoding="oem")
1827-
os.rmdir(path1)
1828-
os.rmdir(path2)
1829-
out1=out1.replace(path1,"<PATH>")
1830-
out2=out2.replace(path2,"<PATH>")
1831-
self.assertNotEqual(out1,out2)
1817+
path=os.path.abspath(os.path.join(os_helper.TESTFN,'dir'))
1818+
os.mkdir(path,mode=0o700)
1819+
out=subprocess.check_output(["cacls.exe",path,"/s"],encoding="oem")
1820+
os.rmdir(path)
1821+
self.assertEqual(
1822+
out.strip(),
1823+
f'{path} "D:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;FA;;;OW)"',
1824+
)
18321825

18331826
deftearDown(self):
18341827
path=os.path.join(os_helper.TESTFN,'dir1','dir2','dir3',

‎Modules/posixmodule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5590,7 +5590,7 @@ os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd)
55905590
if (mode==0700/* 0o700 */) {
55915591
ULONGsdSize;
55925592
pSecAttr=&secAttr;
5593-
// Set adiscreationary ACL (D) that is protected (P) and includes
5593+
// Set adiscretionary ACL (D) that is protected (P) and includes
55945594
// inheritable (OICI) entries that allow (A) full control (FA) to
55955595
// SYSTEM (SY), Administrators (BA), and the owner (OW).
55965596
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp