[openwrt/openwrt] prereq-build: replace relative symlinks only if broken

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


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

commit e972e4f2a9ecbb65b826f53b890e4705c6034f43
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Mon May 29 05:38:33 2023 -0400

    prereq-build: replace relative symlinks only if broken
    
    Some programs installed to staging_dir/host/bin
    also install some symlinks to itself
    for an alternative name.
    
    Some of those new symlinks are overwriting
    symlinks that were installed by prereq stage.
    
    If prereq stage were to somehow be run again,
    it should not be overwriting symlinks
    that point to programs that are already built.
    
    To filter that out, catch all symlinks
    after first catching all symlinks
    that have an absolute target
    after all other cases in the case statement,
    make sure it is not broken, and if so 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 b890e2fbf9211648ad4a74f3e8b47bbf04a3cc7a)
---
 include/prereq.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/prereq.mk b/include/prereq.mk
index ada11a8701..88ed1f406a 100644
--- a/include/prereq.mk
+++ b/include/prereq.mk
@@ -114,6 +114,11 @@ define SetupHostCommand
 						find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \
 						[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
 						;; \
+					*" -> /"*) \
+						;; \
+					*" -> "*) \
+						[ -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