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

Appearance settings

Commit 6d0850c

Browse filesBrowse files
gh-118486: Simplify test_win32_mkdir_700 to check the exact ACL (GH-119056)
(cherry picked from commit 94591dc) Co-authored-by: Steve Dower <steve.dower@python.org>
1 parent bac277f commit 6d0850c
Copy full SHA for 6d0850c

File tree

Expand file treeCollapse file tree

2 files changed

+9
-16
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-16
lines changed

‎Lib/test/test_os.py

Copy file name to clipboardExpand all lines: Lib/test/test_os.py
+8-15Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,21 +1800,14 @@ def test_exist_ok_existing_regular_file(self):
18001800
@unittest.skipUnless(os.name == 'nt', "requires Windows")
18011801
def test_win32_mkdir_700(self):
18021802
base = os_helper.TESTFN
1803-
path1 = os.path.join(os_helper.TESTFN, 'dir1')
1804-
path2 = os.path.join(os_helper.TESTFN, 'dir2')
1805-
# mode=0o700 is special-cased to override ACLs on Windows
1806-
# There's no way to know exactly how the ACLs will look, so we'll
1807-
# check that they are different from a regularly created directory.
1808-
os.mkdir(path1, mode=0o700)
1809-
os.mkdir(path2, mode=0o777)
1810-
1811-
out1 = subprocess.check_output(["icacls.exe", path1], encoding="oem")
1812-
out2 = subprocess.check_output(["icacls.exe", path2], encoding="oem")
1813-
os.rmdir(path1)
1814-
os.rmdir(path2)
1815-
out1 = out1.replace(path1, "<PATH>")
1816-
out2 = out2.replace(path2, "<PATH>")
1817-
self.assertNotEqual(out1, out2)
1803+
path = os.path.abspath(os.path.join(os_helper.TESTFN, 'dir'))
1804+
os.mkdir(path, mode=0o700)
1805+
out = subprocess.check_output(["cacls.exe", path, "/s"], encoding="oem")
1806+
os.rmdir(path)
1807+
self.assertEqual(
1808+
out.strip(),
1809+
f'{path} "D:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;FA;;;OW)"',
1810+
)
18181811

18191812
def tearDown(self):
18201813
path = os.path.join(os_helper.TESTFN, 'dir1', 'dir2', 'dir3',

‎Modules/posixmodule.c

Copy file name to clipboardExpand all lines: Modules/posixmodule.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5364,7 +5364,7 @@ os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd)
53645364
if (mode == 0700 /* 0o700 */) {
53655365
ULONG sdSize;
53665366
pSecAttr = &secAttr;
5367-
// Set a discreationary ACL (D) that is protected (P) and includes
5367+
// Set a discretionary ACL (D) that is protected (P) and includes
53685368
// inheritable (OICI) entries that allow (A) full control (FA) to
53695369
// SYSTEM (SY), Administrators (BA), and the owner (OW).
53705370
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.