From 249a5b35f23475f57bc987f4860302cf933e4fe5 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 10 Sep 2010 10:38:17 -0600 Subject: [PATCH] build: use portable sed expressions * src/Makefile.am (libvirt.def, libvirt_qemu.def): '\}' and '\t' are not required by POSIX. Use '}' and literal tab instead. (install-data-local): Avoid sed -i. * tests/read-bufsiz: Likewise. Reported by Mitchell Hashimoto. --- src/Makefile.am | 12 ++++++++---- tests/read-bufsiz | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index b3216579c7..9bc42872c3 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/[ ]*\(.*\)\;/ \1/g' $^ >> $@-tmp && \ chmod a-w $@-tmp && \ mv $@-tmp libvirt.def libvirt_qemu.def: $(srcdir)/libvirt_qemu.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/[ ]*\(.*\)\;/ \1/g' $^ >> $@-tmp && \ chmod a-w $@-tmp && \ mv $@-tmp libvirt_qemu.def @@ -1177,8 +1177,12 @@ if WITH_NETWORK $(INSTALL_DATA) $(srcdir)/network/default.xml \ $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml test -z "$(UUID)" || \ - sed -i -e "s,,\n $(UUID)," \ - $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml + { sed -e "s,,\n $(UUID)," \ + $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml > \ + $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml.t && \ + cp $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml.t \ + $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml && \ + rm $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml.t; } test -e $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml || \ ln -s ../default.xml \ $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml diff --git a/tests/read-bufsiz b/tests/read-bufsiz index f0f03b9432..2a91bcf5b2 100755 --- a/tests/read-bufsiz +++ b/tests/read-bufsiz @@ -1,7 +1,7 @@ #!/bin/sh # ensure that reading a file larger than BUFSIZ works -# Copyright (C) 2008 Red Hat, Inc. +# Copyright (C) 2008, 2010 Red Hat, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,10 +30,10 @@ fi fail=0 # Output a valid definition, to be used as input. -$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml || fail=1 +$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml.t || fail=1 # Change the VM name -sed -i -e "s|test|newtest|g" xml +sed -e "s|test|newtest|g" xml.t > xml for i in before after; do # The largest BUFSIZ I've seen is 128K. This is slightly larger.