fix(windows): block reserved names in tools#17998
fix(windows): block reserved names in tools#17998applerom 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.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found potentially related PRs that addressed similar Windows reserved names issues in the past: Related PRs:
These appear to be historical fixes rather than active duplicates. PR #17998 seems to be a more comprehensive fix that blocks reserved names across write, edit, and patch flows while also handling literal redirect targets. These older PRs addressed specific instances of the problem but didn't have the complete solution PR #17998 provides. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Summary
Why
On native Windows, OpenCode can run the bash tool through Git Bash or another POSIX shell. In that setup, cmd-style redirects like
>NULcan create a literal reserved-name artifact instead of discarding output. File-writing tools also accepted reserved Windows basenames directly, which made the issue harder to recover from once it appeared.This PR keeps the fix intentionally narrow:
Validation
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\"Notes