fix(windows): block reserved names in tools#18076
fix(windows): block reserved names in tools#18076applerom wants to merge 1 commit intoanomalyco:devfrom
Conversation
Reject reserved Windows device basenames in file-writing and patch flows, and prevent literal reserved-name redirects like when the bash tool runs in a POSIX shell on Windows. This keeps the fix scoped to the observed Windows/Git Bash artifact without trying to model full shell expansion semantics.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found related PRs that address similar Windows reserved names issues:
These PRs suggest there have been previous efforts to address Windows reserved name issues. You should verify whether PR #11605 and #13406 were already merged or closed, and whether this PR (18076) is intended to supersede or complement them. |
Issue for this PR
Fixes #13369
Type of change
What does this PR do?
This fixes a native Windows footgun around reserved device names.
It rejects reserved Windows basenames like
NUL,CON,PRN,AUX,COM1-COM9, andLPT1-LPT9in the write, edit, and patch flows so those tools fail early instead of creating paths that Windows treats specially.It also adds a narrow bash-side guard for literal reserved-name redirect targets when the bash tool is running through a POSIX shell on Windows (for example Git Bash). This covers the observed
>NULcase that can create an undeletable artifact on native Windows.The bash change is intentionally limited to literal redirect targets. It does not try to evaluate full dynamic shell expansion semantics.
How did you verify your code works?
I tested this locally on native Windows after rebasing onto the latest
dev.Commands run:
bun test test/tool/bash.test.ts test/tool/apply_patch.test.ts test/tool/edit.test.ts test/tool/write.test.tsbun test test/util/filesystem.test.ts --test-name-pattern "Windows reserved names"Screenshots / recordings
Not a UI change.
Checklist