bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "grep '\]'" warnings suggest a Gnulib DFA patch


From: Jeffrey Walton
Subject: Re: "grep '\]'" warnings suggest a Gnulib DFA patch
Date: Fri, 3 Jun 2022 22:26:21 -0400

On Fri, Jun 3, 2022 at 9:54 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> While testing, I discovered that master-branch grep's bootstrap script
> contained a regular expression with '\]' that master-branch grep now
> warns about. I fixed this portability bug in 'bootstrap' by installing
> the following patch into Gnulib and propagating this into grep master:
>
> https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=762bd0aa660b0c1c02597e0d2e5c5fbf9bab1b91
>
> Even though POSIX says the interpretation of \] is undefined (which
> means the Gnulib patch is helpful), it's unlikely that any
> POSIX-conforming regular expression matcher would do anything other than
> treat \] like plain ]. And this suggests that GNU grep's warning about
> \] is perhaps more trouble than it's worth.
>
> So, what do you think of the idea of not warning for this particular
> stray backslash? Proposed Gnulib patch attached, with the idea of
> propagating this into GNU grep before its upcoming release. I haven't
> installed this.

It is probably best to keep grep silent and let tools like Shellcheck
complain about it. Otherwise the noise created by grep will generate
user bug reports and questions that you will have to spend time on.

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]