From: Andrew Cooper Date: Thu, 29 Aug 2019 17:19:25 +0000 (+0100) Subject: tools/shim: Fix race condition creating linkfarm.stamp X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1671 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bf82703e8df0486cf0571d99c8f8d44991cfb8c9;p=xen.git tools/shim: Fix race condition creating linkfarm.stamp In the case the while loop gets interrupted, the target musn't appear as up-to-date. The mov $X.tmp $X must be the last action of the rule. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- diff --git a/tools/firmware/xen-dir/Makefile b/tools/firmware/xen-dir/Makefile index 697bbbd57b..df3f5a7006 100644 --- a/tools/firmware/xen-dir/Makefile +++ b/tools/firmware/xen-dir/Makefile @@ -32,9 +32,9 @@ linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE echo $(f) >> linkfarm.stamp.tmp ;) cmp -s linkfarm.stamp.tmp linkfarm.stamp && \ rm linkfarm.stamp.tmp || { \ + cat linkfarm.stamp.tmp | while read f; \ + do rm -f "$(D)/$$f"; ln -s "$(XEN_ROOT)/$$f" "$(D)/$$f"; done; \ mv linkfarm.stamp.tmp linkfarm.stamp; \ - cat linkfarm.stamp | while read f; \ - do rm -f "$(D)/$$f"; ln -s "$(XEN_ROOT)/$$f" "$(D)/$$f"; done \ } # Copy enough of the tree to build the shim hypervisor