Repository navigation
sed: with --posix, reject Q, q exit codes, addr,+N and the I/M modifiers - #703
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #703 +/- ##
=======================================
Coverage 94.14% 94.15%
=======================================
Files 14 14
Lines 5741 5745 +4
Branches 458 463 +5
=======================================
+ Hits 5405 5409 +4
Misses 335 335
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing |
| } | ||
|
|
||
| // addr1,+N is a GNU extension. | ||
| if context.posix && !line.eol() && line.current() == '+' { |
There was a problem hiding this comment.
could be dedup with the check just below, no?
something like (is_address_char(c) || (c == '+' && !context.posix)) in has_addr2
| } | ||
| match line.current() { | ||
| // The I and M modifiers are GNU extensions. | ||
| c @ ('I' | 'M') if context.posix => { |
There was a problem hiding this comment.
why not just 'I' if !context.posix and 'M' if !context.posix so it breaks and the command parser rejects it?
it would be consistent with Q/z/W ("invalid command code")
|
thanks for the PR! |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
These are GNU extensions, and GNU sed --posix refuses them when the script is compiled. Leave `l N` to uutils#345 and uutils#552, which already reject it. Closes uutils#650 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up. The +N check is part of has_addr2, and I/M are left to
the command parser under --posix ("invalid command code"), like Q. The
test no longer pipes input to scripts sed rejects before reading it,
which failed with a broken pipe on Linux and macOS.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
a4bdf20 to
f91ba91
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Thanks for your PR |
With
--posix, GNU sed refuses these GNU extensions when it compiles the script, and exits 1. uutils sed accepted and ran them:addr1,+Nranges (1,+1p):unexpected,'`Qcommand: unknown commandq(q5,$q 5):extra characters after commandIandMaddress modifiers (/A/Ip,/a/Mp): unknown commandEach is now a compile error under
--posix. Without--posixnothing changes. The messages follow GNU's wording in uutils' own error format.l Nfrom the same issue is left out, because #345 and #552 already reject it.The new test covers each case with
--posix, and checks that1,+1p,/A/IpandQstill work without it. It fails onmain. The rest of the suite is unchanged (the 48 tests that fail on Windowsmainbecause of CRLF still fail here, no new ones).Closes #650
AI disclosure: written with help from Claude Code.
🤖 Generated with Claude Code