[Bug 198552] awk unmatched right parenthesis in regular expressions
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Mar 12 22:08:44 UTC 2015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198552
Bug ID: 198552
Summary: awk unmatched right parenthesis in regular expressions
Product: Base System
Version: 9.3-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: weeks at iastate.edu
Created attachment 154253
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=154253&action=edit
Patch to awk 20121220 b.c
awk version 20121220 disallows the use of an unmatched right parenthesis in
regular expressions:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ awk 'BEGIN { print match("...)", ")") }'
awk: illegal primary in regular expression ) at
source line number 1
context is
BEGIN { print match("...)", >>> ")") <<<
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The unmatched right parenthesis should be allowed in this context, as
POSIX.1-2008
(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04_03)
states the following in section 9.4.3 (ERE Special Characters):
"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."
I contacted Mr. BWK, who agreed that it was a bug. I then attempted to fix it
using the attached patch, which I submitted to BWK, but didn't get a response.
Consequently, don't have high hopes for this issue being fixed upstream, but
I'm submitting this bug report so that it is documented somewhere.
--
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/
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list