diff options
author | rillig <rillig@pkgsrc.org> | 2020-05-02 05:52:09 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-05-02 05:52:09 +0000 |
commit | 8c5b62a8a8538d31a19d5288079ac429c1c249c3 (patch) | |
tree | a4ec87a9649deb9ec246d890eb58b4ecff1f7538 /mk | |
parent | afe833d17e14eba33dbcd6af406ba08967e44969 (diff) | |
download | pkgsrc-8c5b62a8a8538d31a19d5288079ac429c1c249c3.tar.gz |
mk/subst.mk: fix shell parse error for special sed expressions
The escaping inside the backticks had been wrong. Because of this,
parentheses and semicolons were interpreted as shell syntax.
Switching to $(...) command substitution removes the need for quoting
some of the characters and makes the whole command simpler to understand.
Doing the escaping for the backticks command properly would have involved
lots of special cases.
The $(...) command substitution was used sparingly in pkgsrc up to now
because some older or broken shells do not support it. Since these
shells do not end up as the shell that runs the commands from Makefiles,
that's not a problem.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/subst.mk | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mk/subst.mk b/mk/subst.mk index e27b94adacd..58cad799670 100644 --- a/mk/subst.mk +++ b/mk/subst.mk @@ -1,4 +1,4 @@ -# $NetBSD: subst.mk,v 1.91 2020/05/01 19:53:48 rillig Exp $ +# $NetBSD: subst.mk,v 1.92 2020/05/02 05:52:09 rillig Exp $ # # The subst framework replaces text in one or more files in the WRKSRC # directory. Packages can define several ``classes'' of replacements. @@ -200,7 +200,7 @@ ${_SUBST_COOKIE.${class}}: ${SUBST_FILTER_CMD.${class}} < "$$file" > "$$tmpfile"; \ ${CMP} -s "$$tmpfile" "$$file" && { \ ${AWK} -f ${PKGSRCDIR}/mk/scripts/subst-identity.awk -- ${SUBST_SED.${class}} \ - && found=`LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,:C,[\\`"],\\\\&,g} "$$file"` \ + && found=$$(LC_ALL=C ${SED} -n ${SUBST_SED.${class}:C,^['"]?s.*,&p,} "$$file") \ && [ -n "$$found" ] && { \ changed=yes; \ continue; \ |