From 92ee64f7601be077e52375976e4e144e7c524343 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 19 Jun 2020 08:32:26 -0400 Subject: [PATCH] TT#84350 fix make races On some systems (e.g. Github Travis) make seems to have a problem with its job control, resulting in a race condition where multiple make instances try to build the same file at the same time. For most files this is not a problem, but those auto-generated using an append operation (>>) the output file can become garbled. Solve this by using an atomic file creation method. Change-Id: I1acb2387e2ca6ca30ddc3742143fd910032bfbb0 --- lib/common.Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/common.Makefile b/lib/common.Makefile index e4fc0cf0e..0abed7cc5 100644 --- a/lib/common.Makefile +++ b/lib/common.Makefile @@ -25,14 +25,12 @@ install: $(OBJS): Makefile $(LIBSRCS): $(patsubst %,../lib/%,$(LIBSRCS)) - rm -f "$@" - echo '/******** GENERATED FILE ********/' > "$@" - cat ../lib/"$@" >> "$@" + ( echo '/******** GENERATED FILE ********/' && \ + cat ../lib/"$@" ) > "$@" $(DAEMONSRCS) $(HASHSRCS): $(patsubst %,../daemon/%,$(DAEMONSRCS)) $(patsubst %,../daemon/%,$(HASHSRCS)) - rm -f "$@" - echo '/******** GENERATED FILE ********/' > "$@" - cat ../daemon/"$@" >> "$@" + ( echo '/******** GENERATED FILE ********/' && \ + cat ../daemon/"$@" ) > "$@" %.8: %.pod pod2man \