Skip to content

POSIX equivalence classes [[=c=]] do not match like GNU #35

Description

@sylvestre

GNU grep supports POSIX equivalence classes [[=c=]] inside bracket expressions; in the C locale [[=a=]] is equivalent to [a]. uu_grep does not — [[=a=]] matches nothing (silently, no error), and putting one inside a larger bracket expression breaks the whole expression so even its plain members stop matching.

Found by the differential fuzzer (fuzz_grep).

Rust (incorrect)

$ printf 'a\nb\n' | ./target/release/grep '[[=a=]]'
# Output: (none)
# Exit code: 1

GNU (correct)

$ printf 'a\nb\n' | LC_ALL=C /usr/bin/grep '[[=a=]]'
a
# Exit code: 0

The class is poisoned for its other members too: grep '[[=a=]b]' matches a and b in GNU but nothing in uu_grep.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions