bug-grep
[Top][All Lists]
Advanced

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

bug#39678: POSIXLY_CORRECT removal, and oddball regex doc


From: Paul Eggert
Subject: bug#39678: POSIXLY_CORRECT removal, and oddball regex doc
Date: Sat, 21 May 2022 03:05:38 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

Looking again at grep bug 39678 <https://bugs.gnu.org/39678> I noticed that the bug occurs even when grep is not coloring:

echo a | grep -oi --color=never '\a'

This outputs nothing and exits with status 0, which is clearly wrong.

I tracked this down to a bug buried deep in the bowels of glibc regex, a bug that Tomasz also spotted. It's not trivial to fix (the fix that Tomasz sent in doesn't feel right, at least for \X where X is a multibyte letter) and any fix would be low priority since the bug occurs only in regular expressions like '\a' that have unspecified behavior - which means the behavior though wrong nevertheless conforms to POSIX.

I'm inclined to address this by having GNU 'grep' diagnose unspecified regexps like '\a' and exit with status 2, much as it already diagnoses unspecified regexps like '[:alpha:]'. If this approach sounds too drastic, a gentler approach would be for 'grep' to warn about '\a' without changing the exit status for now, and escalate the warning to exit with status 2 in a later 'grep' release.





reply via email to

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