From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10740 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] handle ^ and $ in BRE subexpression start and end as anchors Date: Thu, 24 Nov 2016 09:46:35 -0500 Message-ID: <20161124144635.GU1555@brightrain.aerifal.cx> References: <20161124004448.GV5749@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1479998823 3341 195.159.176.226 (24 Nov 2016 14:47:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 24 Nov 2016 14:47:03 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-10753-gllmg-musl=m.gmane.org@lists.openwall.com Thu Nov 24 15:46:50 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1c9vIV-0007JQ-Dn for gllmg-musl@m.gmane.org; Thu, 24 Nov 2016 15:46:47 +0100 Original-Received: (qmail 7544 invoked by uid 550); 24 Nov 2016 14:46:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7526 invoked from network); 24 Nov 2016 14:46:47 -0000 Content-Disposition: inline In-Reply-To: <20161124004448.GV5749@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10740 Archived-At: On Thu, Nov 24, 2016 at 01:44:49AM +0100, Szabolcs Nagy wrote: > In BRE, ^ is an anchor at the beginning of an expression, optionally > it may be an anchor at the beginning of a subexpression and must be > treated as a literal otherwise. > > Previously musl treated ^ in subexpressions as literal, but at least > glibc and gnu sed treats it as an anchor and that's the more useful > behaviour: it can always be escaped to get back the literal meaning. > > Same for $ at the end of a subexpression. > > Portable BRE should not rely on this, but there are sed commands in > build scripts which do. > > This changes the meaning of the BREs: > > \(^a\) > \(a\|^b\) > \(a$\) > \(a$\|b\) > --- > bit hackish solution, but turns out ctx->re was not used for anything > else than to detect if ^ was at the start of a full bre, changed that > to start of a subexpr now. The renaming of the member from re to start is to prove that there are no other users that get broken by this? If so, I like that. Rich