NetBSD-Bugs archive

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

Re: lib/57530: regex(3): REG_BADRPT raised by { for REG_EXTENDED



The following reply was made to PR lib/57530; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/57530: regex(3): REG_BADRPT raised by { for REG_EXTENDED
Date: Tue, 18 Jul 2023 07:44:58 +0000 (UTC)

 On Tue, 18 Jul 2023, rokuyama.rk%gmail.com@localhost wrote:
 
 >> How-To-Repeat:
 > /bin/echo '{' | /usr/bin/sed -E '/{/p'
 >> Fix:
 > Fix regcomp() or manpages [regex(3) and re_format(7)]
 >
 > Even if we choice the latter, I am not sure whether REG_BADRPT is
 > appropriate here, or not.
 >
 
 I think so. SUSv4 (2018) says of this:
 
 ```
 9.4 Extended Regular Expressions
     *+?{
  	The <asterisk>, <plus-sign>, <question-mark>, and <left-brace>
  	shall be special except when used in a bracket expression (see RE
  	Bracket Expression). Any of the following uses produce undefined
  	results:
 
  	  * If these characters appear first in an ERE, or immediately
  	    following an unescaped <vertical-line>, <circumflex>,
  	    <dollar-sign>, or <left-parenthesis>
 
  	  * If a <left-brace> is not part of a valid interval expression
  	    (see EREs Matching Multiple Characters)
 ```
 
 Ie. this is exactly the same as:
 
 ```
 $ grep -E '*'
 grep: repetition-operator operand invalid
 $
 ```
 
 I think we should amend the man-page.
 
 -RVP
 


Home | Main Index | Thread Index | Old Index