Skip to content

The agent that grows with you

revert(tools): drop the Windows mailbox chmod skip from this PR

unsupportedpastelsca069e12239a
diff --git a/tests/tools/test_bot_live_delivery_mailbox_dir.py b/tests/tools/test_bot_live_delivery_mailbox_dir.py
deleted file mode 100644
index a064257efaf..00000000000
--- a/tests/tools/test_bot_live_delivery_mailbox_dir.py
+++ /dev/null
@@ -1,41 +0,0 @@
-"""The live-delivery mailbox lock dir (``tools.bot_live_delivery._locked``).
-
-POSIX tightens the directory to 0700 on every entry. On Windows the owner-only DACL comes from
-``mkdir(mode=0o700)`` (CPython 3.13+) and chmod only toggles the read-only attribute, so the
-Windows tests pin that the owner keeps re-entering the lock, including in a dir that the older
-chmod-on-every-entry code created.
-"""
-import stat
-
-import pytest
-
-from tools.bot_live_delivery import _locked, _root
-
-
-def test_mailbox_dir_is_tightened_to_owner_only(tmp_path):
- root = _root(tmp_path)
- root.mkdir(parents=True, mode=0o755)
- root.chmod(0o755)
- with _locked(tmp_path):
- pass
- assert stat.S_IMODE(root.stat().st_mode) == 0o700
-
-
-def test_mailbox_lock_is_reenterable_on_windows(tmp_path):
- for _ in range(3): # the live poller re-enters it twice a second
- with _locked(tmp_path):
- pass
- (_root(tmp_path) / ".lock").open("a").close()
-
-
-def test_mailbox_dir_chmodded_by_older_code_stays_lockable_on_windows(tmp_path):
- root = _root(tmp_path)
- root.parent.mkdir(parents=True)
- root.mkdir(mode=0o700)
- root.chmod(0o700) # what _locked did on every entry before it skipped chmod on Windows
- for _ in range(3):
- with _locked(tmp_path):
- pass
diff --git a/tools/bot_live_delivery.py b/tools/bot_live_delivery.py
index f12e4d50cab..ad57c89fb1a 100644
--- a/tools/bot_live_delivery.py
+++ b/tools/bot_live_delivery.py
@@ -121,10 +121,7 @@ def _locked(home: Path | str):
created = not root.is_dir()
root.parent.mkdir(parents=True, exist_ok=True)
root.mkdir(mode=0o700, exist_ok=True)
- if os.name != "nt":
- # Windows chmod only sets or clears the read-only attribute, so it adds nothing there:
- # the owner-only DACL comes from mkdir's mode (CPython 3.13+) when it creates the dir.
- root.chmod(0o700)
+ root.chmod(0o700)
if created:
# Only a fresh mailbox dir needs its parents durably linked; the live
# poller re-enters this lock twice a second per profile, and two