diff mbox

tools/build: remove usage of sed -i

Message ID 1458839113-4354-1-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné March 24, 2016, 5:05 p.m. UTC
The "-i" sed option is not POSIX compatible [0], remove it's usage and
instead create yet another temporary intermediate file.

[0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/include/xen-foreign/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Andrew Cooper March 24, 2016, 5:08 p.m. UTC | #1
On 24/03/16 17:05, Roger Pau Monne wrote:
> The "-i" sed option is not POSIX compatible [0], remove it's usage and
> instead create yet another temporary intermediate file.
>
> [0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>

Sorry for breaking this.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Ian Jackson March 24, 2016, 5:10 p.m. UTC | #2
Andrew Cooper writes ("Re: [Xen-devel] [PATCH] tools/build: remove usage of sed -i"):
> On 24/03/16 17:05, Roger Pau Monne wrote:
> > The "-i" sed option is not POSIX compatible [0], remove it's usage and
> > instead create yet another temporary intermediate file.
> >
> > [0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > Cc: Wei Liu <wei.liu2@citrix.com>
> 
> Sorry for breaking this.
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks,
Ian.
diff mbox

Patch

diff --git a/tools/include/xen-foreign/Makefile b/tools/include/xen-foreign/Makefile
index bb09c93..270a975 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -36,8 +36,9 @@  x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
 	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
-	sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' -i $@.tmp
-	$(call move-if-changed,$@.tmp,$@)
+	sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' < $@.tmp > $@.tmp2
+	rm $@.tmp
+	$(call move-if-changed,$@.tmp2,$@)
 
 checker.c: mkchecker.py structs.py
 	$(PYTHON) $< $@ $(architectures)