[openwrt/openwrt] prereq-build: do not replace binaries with symlinks

LEDE Commits lede-commits at lists.infradead.org
Tue Jun 13 07:49:50 PDT 2023


ynezz pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/43b92ff6ce203dee5049c3ad4f28c95a69dd0694

commit 43b92ff6ce203dee5049c3ad4f28c95a69dd0694
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Sat May 27 17:11:47 2023 -0400

    prereq-build: do not replace binaries with symlinks
    
    Some programs, like bash and patch, are checked by prereq stage
    and have a symlink installed, but then is later built from source.
    
    Now that the prereq-build checks are not successful
    just by finding the file alone, it is possible for
    a new symlink to overwrite the installed binary.
    
    If a normal file is found in staging_dir/host/bin,
    let the check look for the associated stampfile, and if found,
    skip creation of a symlink and exit successfully.
    
    Suggested-by: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
    Signed-off-by: Michael Pratt <mcpratt at pm.me>
    (cherry picked from commit 729909c07fae4201591e51895833112cb88485e1)
---
 include/prereq.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/prereq.mk b/include/prereq.mk
index 45c84e984c..ada11a8701 100644
--- a/include/prereq.mk
+++ b/include/prereq.mk
@@ -110,6 +110,10 @@ define SetupHostCommand
 					*" -> $$$$$$$$bin"*) \
 						[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
 						;; \
+					"-"*) \
+						find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \
+						[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
+						;; \
 				esac; \
 				ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
 				exit 0; \




More information about the lede-commits mailing list