Skip to content

--posix should disable the GNU regular expression escapes (\? \+ \| \w \s) #542

Description

@sylvestre

Found by the differential fuzzer (fuzz/fuzz_targets/fuzz_sed.rs).

With --posix, GNU sed drops the GNU regular expression escapes: \?, \+,
\| are not operators and \w, \s are not classes, they all stand for the
plain character. We keep honoring them.

$ printf 'a\nb\n0?\n' | sed --posix -e '/a\+/d'
a
b
0?
$ printf 'a\nb\n0?\n' | ./target/release/sed --posix -e '/a\+/d'
b
0?

Same for the others:

script GNU --posix deletes we delete
/0\?/d 0? every line (empty match)
/a\+/d nothing a
/a|b/d nothing a and b
/\w/d nothing every line

Until this is fixed the fuzzer skips these scenarios; see KNOWN_ISSUES in
fuzz/fuzz_targets/fuzz_sed.rs.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions