From e5ad0a31b104baec0252e0c53fc6d99709772ad9 Mon Sep 17 00:00:00 2001 From: rillig Date: Mon, 18 May 2020 06:06:34 +0000 Subject: mk/configure/replace-interpreter.mk: silently skip broken symlinks Like directories, they probably come from shell globs. Seen in misc/byobu. --- mk/configure/replace-interpreter.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mk/configure') diff --git a/mk/configure/replace-interpreter.mk b/mk/configure/replace-interpreter.mk index 7eaedcf93a0..8ad691c258b 100644 --- a/mk/configure/replace-interpreter.mk +++ b/mk/configure/replace-interpreter.mk @@ -1,4 +1,4 @@ -# $NetBSD: replace-interpreter.mk,v 1.19 2020/03/24 04:40:34 rillig Exp $ +# $NetBSD: replace-interpreter.mk,v 1.20 2020/05/18 06:06:34 rillig Exp $ # This file provides common templates for replacing #! interpreters # in script files. @@ -31,7 +31,7 @@ # variable, all identifiers starting with "sys-" are reserved for the # pkgsrc infrastructure. All others may be used freely. # -# Keywords: replace_interpreter interpreter interp hashbang #! +# Keywords: replace_interpreter interpreter interp hashbang #! shebang # Keywords: awk bash csh ksh perl sh ###################################################################### @@ -111,7 +111,7 @@ replace-interpreter: ${RUN} set -u; \ cd ${WRKSRC}; \ for f in ${REPLACE_FILES.${_lang_}}; do \ - if [ -f "$${f}" ]; then \ + if [ -f "$$f" ]; then \ ${SED} -e '1s|^#![[:space:]]*${REPLACE.optional-env-space}${REPLACE.${_lang_}.old}|#!${REPLACE.${_lang_}.new}|' \ < "$${f}" > "$${f}.new"; \ if [ -x "$${f}" ]; then \ @@ -123,8 +123,8 @@ replace-interpreter: else \ ${MV} -f "$${f}.new" "$${f}"; \ fi; \ - elif [ -d "$$f" ]; then \ - ${SHCOMMENT} "Ignore it, most probably comes from shell globs"; \ + elif [ -d "$$f" ] || [ -h "$$f" ]; then \ + : 'Ignore it, most probably comes from shell globs'; \ else \ ${WARNING_MSG} "[replace-interpreter] Skipping non-existent file \"$$f\"."; \ fi; \ -- cgit v1.2.3