From bdd0dbda1b08c2af54437d8b76e524cc36d34189 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 28 May 2015 03:52:24 +0200 Subject: [PATCH] build: prevent race condition between tool symlink creation --- ...dition-between-tool-symlink-creation.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/openwrt/0036-build-prevent-race-condition-between-tool-symlink-creation.patch diff --git a/patches/openwrt/0036-build-prevent-race-condition-between-tool-symlink-creation.patch b/patches/openwrt/0036-build-prevent-race-condition-between-tool-symlink-creation.patch new file mode 100644 index 00000000..85ef6c28 --- /dev/null +++ b/patches/openwrt/0036-build-prevent-race-condition-between-tool-symlink-creation.patch @@ -0,0 +1,20 @@ +From: Matthias Schiffer +Date: Thu, 28 May 2015 03:48:14 +0200 +Subject: build: prevent race condition between tool symlink creation + +Filter out STAGING_DIR_HOST binary path to prevent picking up grep from this +path. + +diff --git a/tools/Makefile b/tools/Makefile +index 137ad61..c24bca1 100644 +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -120,7 +120,7 @@ $(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build + define PrepareCommand + $(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR_HOST)/.prepared + @mkdir -p "$$(dir $$@)"; rm -f "$$@" +- @export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \ ++ @export PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))"; export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \ + echo "Command $(1) not found."; false; \ + }; ln -s "$$$$FILE" "$$@" +