|
From: | Paul Eggert |
Subject: | bug#39678: warn about stray backslashes |
Date: | Mon, 23 May 2022 13:03:00 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
On 5/22/22 15:22, Paul Eggert wrote:
We've already uncovered one area, where \a doesn't work as expected and where a warning diagnostic would be helpful.
I installed the attached patch to cause 'grep' to warn about these. Comments welcome. Most of the changes were in Gnulib's dfa module, which see.
Here's another one, where an oddly-placed '*' doesn't work as one would expect: $ printf '*\na\n*a\n' | grep '\(*\)' * *a $ printf '*\na\n*a\n' | grep -E '(*)' grep: Unmatched ( or \( $ printf '*\na\n*a\n' | grep '\(*a\)' *a $ printf '*\na\n*a\n' | grep -E '(*a)' a*a
I plan to look at this next. We shouldn't warn about BREs like '\(*\)' and '\(*a\)' as these conform to POSIX and work fine. But it makes sense to warn about EREs like '(*)', '(*a)', '(+)', '(+a)', '({1})', '({1}a)' as POSIX does not specify their behavior, their semantics are unpredictable with GNU grep, and it's plausible that people are making mistakes in this area.
0001-build-update-gnulib-submodule-to-latest.patch
Description: Text Data
0002-grep-warn-about-stray-backslashes.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |