[BUG] 2>&1 could not "overwrite an arbitrary file"
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Just now, I was running make test 2>&1 and the permission prompt said something like "this command contains an unescaped > which could end up overwriting a file". The addition of a rationale is nice, but in this case it's of course completely incorrect. The specific syntax (number)>(number) redirects an existing file descriptor to a new one and >& changes it to duplication of an existing file descriptor. There is no way this particular syntax could open a file descriptor to a new file.
What Should Happen?
Ideally, the permission prompt should not appear when the only redirection is to a file descriptor. Less ideally, at least the rationale message should not lie.
Error Messages/Logs
Steps to Reproduce
I am unable to trigger this warning message again but I got it just now for make test 2>&1. Annoyingly, Claude Code overwrites the prompt after you have reacted to it so it's not in my scrollback buffer any longer.
Claude tells me that make test 2>&1 should not produce this warning, but I know what I saw (though I am no longer precisely sure which command it ran).
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.50 (Claude Code)
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗