Subject: bin/4833: sed broken wrt '?' and '+' regexps
To: None <gnats-bugs@gnats.netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: netbsd-bugs
Date: 01/16/1998 23:39:28
>Number: 4833
>Category: bin
>Synopsis: sed broken wrt '?' and '+' regexps
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 16 16:20:02 1998
>Last-Modified:
>Originator: Hubert Feyrer
>Organization:
Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>
>Release: 1.3
>Environment:
NetBSD/i386, V1.3
System: NetBSD miyu 1.3 NetBSD 1.3 (MIYU) #6: Wed Dec 31 04:47:13 MET 1997 feyrer@miyu:/data/cvs/src/sys/arch/i386/compile/MIYU i386
>Description:
Neither '?' nor '+' are propperly processed in sed REs.
>How-To-Repeat:
miyu# echo match | sed -ne '/.?/p'
miyu# echo match | sed -ne '/.+/p'
miyu# echo match | sed -ne '/.*/p'
match
>Fix:
Well, a workaround, rather:
--- /usr/src/usr.bin/sed/compile.c.orig Fri Jan 16 23:35:59 1998
+++ /usr/src/usr.bin/sed/compile.c Fri Jan 16 23:33:39 1998
@@ -431,7 +431,7 @@
return (p);
}
*repp = xmalloc(sizeof(regex_t));
- if (p && (eval = regcomp(*repp, re, 0)) != 0)
+ if (p && (eval = regcomp(*repp, re, REG_EXTENDED)) != 0)
err(COMPILE, "RE error: %s", strregerror(eval, *repp));
if (maxnsub < (*repp)->re_nsub)
maxnsub = (*repp)->re_nsub;
>Audit-Trail:
>Unformatted: