Skip to content

sed: reject repeated p option to substitute command - #719

Open
yunusarda-sudo wants to merge 2 commits into
uutils:mainfrom
yunusarda-sudo:fix/sed-subst-repeated-p-flag
Open

yunusarda-sudo wants to merge 2 commits into
uutils:mainfrom
yunusarda-sudo:fix/sed-subst-repeated-p-flag

Conversation

@yunusarda-sudo

Copy link
Copy Markdown
Contributor

GNU sed rejects an s command that repeats the p flag with multiple \p' options to `s' commandand exit status 1. uutils sed previously accepted it and setprint_flag` again.

Check if subst.print_flag is already set when encountering 'p' in compile_subst_flags and raise a compilation error, matching repeated 'g' and repeated numbers.

Fixes #652

GNU sed rejects an s command that repeats the p flag with
"multiple `p' options to `s' command" and exit status 1. uutils sed
previously accepted it and set print_flag again.

Check if subst.print_flag is already set when encountering 'p' in
compile_subst_flags and raise a compilation error, matching repeated 'g'
and repeated numbers.

Fixes uutils#652
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.17%. Comparing base (76faef8) to head (e6e823d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #719   +/-   ##
=======================================
  Coverage   94.17%   94.17%           
=======================================
  Files          14       14           
  Lines        5768     5771    +3     
  Branches      470      471    +1     
=======================================
+ Hits         5432     5435    +3     
  Misses        335      335           
  Partials        1        1           
Flag Coverage Δ
macos_latest 96.14% <100.00%> (+<0.01%) ⬆️
ubuntu_latest 96.02% <100.00%> (+<0.01%) ⬆️
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sed - s///pp (repeated p flag) is accepted instead of rejected

1 participant