From: "Jan Beulich" Subject: Re: [PATCH] build: fix sed usage in build process Date: Tue, 25 Mar 2014 14:06:05 +0000 Message-ID: <53319B5D0200007800001C01@nat28.tlf.novell.com> References: <1395746443-61191-1-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSRzV-00025e-Ui for xen-devel@lists.xenproject.org; Tue, 25 Mar 2014 14:06:10 +0000 In-Reply-To: <1395746443-61191-1-git-send-email-roger.pau@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne Cc: xen-devel@lists.xenproject.org, Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 25.03.14 at 12:20, wrote: > FreeBSD sed is not able to correctly parse the script > '/[0-9]/{s,00*,0,g;p}', so break it into two smaller scripts which > FreeBSD (and Linux) sed is able to parse. First of all - is this again a standard conformance issue? I can't see what's non-conformant with the old approach (which btw had been in place for quite long a time, so I'm puzzled by this being an issue only now), and for future reference purposes it would be nice to know what exactly should be avoided (i.e. to prevent a similar issue from getting introduced again later). > --- a/xen/Rules.mk > +++ b/xen/Rules.mk > @@ -171,7 +171,7 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach n,1 2 4 > 8,rodata.str1.$(n)) \ > $(foreach r,rel rel.ro,data.$(r) data.$(r).local) > > $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile > - $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p}' | while read idx name sz rest; do \ > + $(OBJDUMP) -h $< | sed -re 's/0+/0/g' -ne '/[0-9]/p' | while read idx name sz rest; do \ Is there a particular reason for moving the -n to the second expression specification? And I take it that you adding -r and the use of + isn't really necessary either - the 00* approach should work equally well without using the non-standard (but apparently more wide spread) -r? (Yes, we're just about to commit other uses of -r, but there the alternative would be more difficult to grok, so has better justification.) Jan