You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sed - s///pp (repeated p flag) is accepted instead of rejected #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 accepts it and prints the
line. Repeated g and repeated numbers are already rejected with GNU's messages (74f73e0); p
is the remaining case.
Reproduction
Rust (incorrect)
$ printf'a\n'| ./target/release/sed 's/a/b/pp'
b
b
# Exit code: 0
compile_subst_flags in src/sed/compiler.rs:1027-1032 sets the flag without checking whether
it was already set, unlike the g arm just above it:
'g' => {if subst.global{returncompilation_error(lines, line,"multiple `g' options to `s' command");}
...
'p' => {
subst.print_flag = true;// 'p' is applied before 'e' iff 'e' has not been seen yet.
subst.p_before_e = !subst.execute;
line.advance();}
Test
#[rstest]#[case::adjacent("s/a/b/pp")]#[case::separated("s/a/b/pgp")]fntest_subst_repeated_p_flag_rejected(#[case]script:&str){new_ucmd!().arg(script).pipe_in("a\n").fails().code_is(1).stderr_contains("multiple `p' options to `s' command");}
Reported by Anthropic's OSS Scanner (ANT-2026-FNVSC9N4).
Activity