emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#17856: closed (Unmatched right parenthesis in ERE)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17856: closed (Unmatched right parenthesis in ERE)
Date: Fri, 27 Jun 2014 19:37:02 +0000

Your message dated Fri, 27 Jun 2014 12:35:48 -0700
with message-id <address@hidden>
and subject line Re: bug#17856: Unmatched right parenthesis in ERE
has caused the debbugs.gnu.org bug report #17856,
regarding Unmatched right parenthesis in ERE
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
17856: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17856
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Unmatched right parenthesis in ERE Date: Thu, 26 Jun 2014 08:10:29 -0500
GNU grep 2.20 disallows the use of an unmatched right parenthesis in
an extended regular expression:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ echo ')' | grep -E ')'
grep: Unmatched ) or \)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Other greps I've tried (AST grep 2014-01-06, BusyBox 1.22.1 grep, BSD
grep 2.5.1-FreeBSD on OS X 10.8, /usr/xpg4/bin/grep on Solaris
11.2-beta) accept ')' as a valid ERE.

POSIX apparently allows an unmatched right parenthesis in this
context, as section 9.4.3 (ERE Special Characters;
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04_03)
states:

"The <right-parenthesis> shall be special when matched with a preceding
<left-parenthesis>, both outside a bracket expression."

and in section 9.5.1 (BRE/ERE Grammar Lexical Conventions)
(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_05_01),
the description of the "SPEC_CHAR" token contains the following
exception:

"The close-parenthesis shall be considered special in this context only if
matched with a preceding open-parenthesis."

--
Nathan Weeks
IT Specialist
USDA-ARS Corn Insects and Crop Genetics Research Unit
Crop Genome Informatics Laboratory
Iowa State University
http://weeks.public.iastate.edu/



--- End Message ---
--- Begin Message --- Subject: Re: bug#17856: Unmatched right parenthesis in ERE Date: Fri, 27 Jun 2014 12:35:48 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
address@hidden wrote:
Y'all might want to consider basing RE_SYNTAX_POSIX_EGREP
off of RE_SYNTAX_POSIX_EXTENDED; that would have gotten this case.

At some point we should clean out those old RE_SYNTAX_* macros; half of them are just plain wrong anyway. However, doing that will require a fix to glibc, which would take quite a long time to propagate through, and in the meantime the attached patch should suffice. I've installed it and it should appear in the next grep release. Thanks for reporting the bug, Nathan.

Attachment: 0001-grep-with-E-unmatched-matches-itself.patch
Description: Text document


--- End Message ---

reply via email to

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