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

Re: [libvirt] [PATCH] Use SED variable for `sed` binary in src/Makefile



On 09/09/2010 12:41 AM, Mitchell Hashimoto wrote:
> Hi,
>
> I've been trying to get libvirt (client) to cleanly/easily compile on
> BSD-based systems (in this case OS X). "./configure" runs fine but the
> "make" caused an error with `sed` since BSD sed was reporting some sort of
> regex error. I realized that the "SED" variable was populated with "gsed"
> which worked properly. This made the make continue (failed again later, will
> address that when I can).

---
  src/Makefile.am |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index b321657..118c329 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1029,14 +1029,14 @@ libvirt.syms: libvirt_public.syms $(USED_SYM_FILES)
  libvirt.def: libvirt.syms
         $(AM_V_GEN)rm -f -- $ -tmp $@ ; \
         printf 'EXPORTS\n'>  $ -tmp&&  \
-       sed -e '/^$$/d; /#/d; /:/d; /\}/d; /\*/d; /LIBVIRT_/d; s/[
\t]*\(.*\)\;/    \1/g' $^>>  $ -tmp&&  \
+       $(SED) -e '/^$$/d; /#/d; /:/d; /\}/d; /\*/d; /LIBVIRT_/d; s/[
\t]*\(.*\)\;/    \1/g' $^>>  $ -tmp&&  \

Thanks for the report. Hmm - the real problem here is that we are relying on a non-portable sed construct. Using $(SED) is a crutch that will let other users substitute gsed when needed, but the real fix is to correct the sed expression to be portable to POSIX rules in the first place.

Neither \} nor \t are portable:

$ printf 'a\tc\n}\n' | /usr/bin/sed '/\}/d; s/[\t]/ /'
sed: 1: "/\}/d": RE error: parentheses not balanced
$ printf 'abc\n}\n' | /usr/bin/sed '/}/d; s/[\t]/ /'
a	c
$ printf 'abc\n}\n' | gsed '/\}/d; s/[\t]/ /'
a c

So, I'll propose a better patch that fixes the regex to be portable, at which point, I think we no longer need to worry about using $(SED) in the first place.

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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