[GH-ISSUE #3501] [Other] in_trash misses Windows Recycle Bin paths on Linux (Path does not split backslashes) #1434

Closed
opened 2026-11-04 01:51:14 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheHubUser4860938 on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3501

Problem: the in_trash() helper added for #3410 (strata_control/discovery.py) never matches a Windows Recycle Bin path when it runs on Linux: Path(path).parts treats a backslash as an ordinary character on POSIX, so the whole path arrives as ONE part and $RECYCLE.BIN is never seen. Upstream's own #3410 test fails on Linux for exactly this reason.

Expected: the function's docstring names $RECYCLE.BIN\.. and test_issues_022.py asserts a Windows Recycle Bin path on every OS the suite runs on; both should hold on Linux.

Actual (reproduced locally, clean v0.2.1.3, Linux, Python 3.14):

git checkout v0.2.1.3
python -m pytest "tests/terminal/test_issues_022.py::Issue3410TrashIsNotAnInstall::test_trash_folders_are_recognised" -q
> AssertionError: False is not true : C:\$Recycle.Bin\S-1-5-21\$R123\Strata

or directly: python -c "from strata_control.discovery import in_trash; print(in_trash(r'C:\$Recycle.Bin\S-1-5-21\x\Strata'))" prints False on Linux, True on Windows.

Scope of the user-visible effect, stated honestly: on Linux, paths read live from a mounted NTFS drive arrive POSIX-style (/mnt/d/$RECYCLE.BIN/...) and DO match today; the gap is Windows-shaped path strings on Linux - the case the docstring and the test name (and a Linux install reading a settings file written by its Windows twin would produce).

CI note: the repository's workflows run only tests/terminal/test_runtime.py (terminal-minimal-server) plus the monitor jobs, so test_issues_022.py is not exercised on Linux in CI - which is why this shipped.

Suggested fix (one line; a no-op on Windows, where Path already split the backslashes):

parts = [x.lower() for p in Path(path).parts for x in p.split("\\")]

With exactly this line, tests/terminal/test_issues_022.py passes in full on Linux (26 passed). Our fork merge carried the fix already; posting so upstream can take it.

Reproduction status: reproduced locally (test failure on the clean tag).
Environment: v0.2.1.3 (cbfd5b92), Linux, Python 3.14; no GPU involved - Terminal/discovery code only.

Originally created by @TheHubUser4860938 on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3501 Problem: the `in_trash()` helper added for #3410 (`strata_control/discovery.py`) never matches a Windows Recycle Bin path when it runs on Linux: `Path(path).parts` treats a backslash as an ordinary character on POSIX, so the whole path arrives as ONE part and `$RECYCLE.BIN` is never seen. Upstream's own #3410 test fails on Linux for exactly this reason. Expected: the function's docstring names `$RECYCLE.BIN\..` and `test_issues_022.py` asserts a Windows Recycle Bin path on every OS the suite runs on; both should hold on Linux. Actual (reproduced locally, clean `v0.2.1.3`, Linux, Python 3.14): ``` git checkout v0.2.1.3 python -m pytest "tests/terminal/test_issues_022.py::Issue3410TrashIsNotAnInstall::test_trash_folders_are_recognised" -q > AssertionError: False is not true : C:\$Recycle.Bin\S-1-5-21\$R123\Strata ``` or directly: `python -c "from strata_control.discovery import in_trash; print(in_trash(r'C:\$Recycle.Bin\S-1-5-21\x\Strata'))"` prints `False` on Linux, `True` on Windows. Scope of the user-visible effect, stated honestly: on Linux, paths read live from a mounted NTFS drive arrive POSIX-style (`/mnt/d/$RECYCLE.BIN/...`) and DO match today; the gap is Windows-shaped path strings on Linux - the case the docstring and the test name (and a Linux install reading a settings file written by its Windows twin would produce). CI note: the repository's workflows run only `tests/terminal/test_runtime.py` (terminal-minimal-server) plus the monitor jobs, so `test_issues_022.py` is not exercised on Linux in CI - which is why this shipped. Suggested fix (one line; a no-op on Windows, where Path already split the backslashes): ```python parts = [x.lower() for p in Path(path).parts for x in p.split("\\")] ``` With exactly this line, `tests/terminal/test_issues_022.py` passes in full on Linux (26 passed). Our fork merge carried the fix already; posting so upstream can take it. Reproduction status: reproduced locally (test failure on the clean tag). Environment: v0.2.1.3 (cbfd5b92), Linux, Python 3.14; no GPU involved - Terminal/discovery code only.
Author
Owner

@Niko1221 commented on GitHub (Oct 21, 2026):

Fixed for 0.2.2, the next release (not out yet). Thanks, taken as you wrote it with your authorship kept, plus a test that runs on any OS.

<!-- gh-comment-id:6308101836 --> @Niko1221 commented on GitHub (Oct 21, 2026): Fixed for 0.2.2, the next release (not out yet). Thanks, taken as you wrote it with your authorship kept, plus a test that runs on any OS.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1434
No description provided.