Austin Group Defect Tracker

Aardvark Mark III

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001139 [1003.1(2013)/Issue7+TC1] Base Definitions and Headers Objection Enhancement Request 2017-05-02 14:08 2017-05-02 14:08
Reporter stephane View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Stephane Chazelas
User Reference
Section 9.3.2 BRE Ordinary Characters (and same for ERE)
Page Number 183 and below
Line Number 6044 and below
Interp Status ---
Final Accepted Text
Summary 0001139: require RE \] to match ] when outside bracket expressions
Description Currently, since `]` is an ordinary character, the behaviour for

grep '\[foo\]'

is "undefined". POSIX tells us to do:

grep '\[foo]'


However, it's very common for people to write grep '\[foo\]' when they meant grep '\[foo]' and no BRE implementation that I know treats \] any different from ] there.

So I'd suggest this be engraved in the spec, that BRE \] be *required* to match a "]" when outside bracket expressions (note: I'd rather [xy\] be unspecified, favouring the more portable [xy\\] instead but that would be a separate issue).

Same applies to ERE \] and \}
Desired Action The enhancement request is not for ] (and } in EREs) to be considered as "special characters", but for \] and \} to be guaranteed to match the ] and } respectively so the common "grep '\[x\]'" becomes standard/portable. That is, prohibit implementations from implementing extensions that would treat \] and ERE \} specially (very unlikely that they would anyway given that \[ and ERE \{ are required by POSIX to match [ and {).

Changes (requested additions in {{...}})

9.3.1: a special character {{or ']'}} preceded by[...]
9.3.2: {{* the ']' character outside of bracket expressions, "\]" being required to match a ']' character}}
9.4.1: "a special character{{, ']' or '}'}} preceded by"[...]
9.4.2: ordinary character{{ except ']' and '}'}} preceded by[...]
       "\]" and "\}" shall match the ']' and '}' characters respectively.
9.5.1: add \] to QUOTED_CHAR in BREs, and \] and \} in EREs
Tags No tags attached.
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2017-05-02 14:08 stephane New Issue
2017-05-02 14:08 stephane Name => Stephane Chazelas
2017-05-02 14:08 stephane Section => 9.3.2 BRE Ordinary Characters (and same for ERE)
2017-05-02 14:08 stephane Page Number => 183 and below
2017-05-02 14:08 stephane Line Number => 6044 and below

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker