Re: lvm2 portability issues (GNU sed is assumed)

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

 



On 01/30/2013 03:55 AM, Alasdair G Kergon wrote:
On Tue, Jan 29, 2013 at 08:51:21PM +0100, John Spencer wrote:
may i ask kindly to reformulate that statement so that it works with
posix sed (as used in busybox 1.20.2) ?

I'm perfectly happy using modern extensions to these tools:)

If you want this to work with alternative versions, please send a tested
patch for us to incorporate.  (Either modifications to the commands so
it works with both or else alternative versions which configure chooses
between.)

a couple of regex experts looked at it, and the reason it didnt work is simply a bug: the \ before d is wrong. apparently the author meant to escape the makefile variable that follows, but that is not necessary and so the backslash gets passed on.

find attached a patch that works correctly with gnu sed and busybox sed.

btw: apparently there are 2 other bugs in that sed statement:
| should become \| to work as intended by the author (gnu sed only), and [ \*] should become [ *]. but apparently this part of the regex isn't used anyway, so it might be the best to just remove it. i left that part unfixed, as it is not crucial, so someone else might want to look at it.

thanks,
--JS


Alasdair



>From d0c71ccfe812e38f49ce4223f4cc768dfc28ae70 Mon Sep 17 00:00:00 2001
From: John Spencer <maillist-lvm@barfooze.de>
Date: Thu, 31 Jan 2013 04:15:22 +0100
Subject: [PATCH] make.tmpl.in: fix buggy sed statement that worked by luck using gnu sed

The erroneous \ is ignored using gnu sed, but not by busybox sed (POSIX conformant).

Signed-Off-By: John Spencer <maillist-lvm@barfooze.de>

---
 make.tmpl.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/make.tmpl.in b/make.tmpl.in
index 8b56f01..cd49396 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -392,7 +392,7 @@ distclean: cleandir $(SUBDIRS.distclean)
 	( cat $(srcdir)/.exported_symbols; \
 	  if test x$(EXPORTED_HEADER) != x; then \
 		$(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \
-		$(SED) -ne "/^typedef|}/!s/.*[ \*]\(\$(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
+		$(SED) -ne "/^typedef|}/!s/.*[ \*]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
 	  fi \
 	) > $@
 
-- 
1.7.3.4

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux