diff options
author | rillig <rillig@pkgsrc.org> | 2020-05-01 06:42:32 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-05-01 06:42:32 +0000 |
commit | 5a0a1754339f313834f2eb581a8a3a65a8e5ba65 (patch) | |
tree | 4c9c0b08697901569916bb455d89eb778a22635e /regress | |
parent | 9ceee6cc4c07cf20c7865420fa5527d8f99eea26 (diff) | |
download | pkgsrc-5a0a1754339f313834f2eb581a8a3a65a8e5ba65.tar.gz |
mk/subst.mk: switch command substitution back to backticks
To work properly, the $(...) should have been $$(...).
In pkgsrc the command substitution is usually done via `backticks`, for
compatibility with /bin/sh from Solaris. To fix the shell parse errors,
the special characters are properly escaped inside the command
substitution.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/infra-unittests/subst.sh | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/regress/infra-unittests/subst.sh b/regress/infra-unittests/subst.sh index 8e7de065189..1535d6e77ad 100644 --- a/regress/infra-unittests/subst.sh +++ b/regress/infra-unittests/subst.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: subst.sh,v 1.27 2020/04/29 22:46:42 rillig Exp $ +# $NetBSD: subst.sh,v 1.28 2020/05/01 06:42:32 rillig Exp $ # # Tests for mk/subst.mk. # @@ -1425,3 +1425,26 @@ if test_case_begin "no-op SUBST_FILTER_CMD in NOOP_OK=no mode"; then test_case_end fi + + +if test_case_begin "backtick in SUBST_SED"; then + + create_file_lines "testcase.mk" \ + 'SUBST_CLASSES+= id' \ + 'SUBST_FILES.id= file' \ + "SUBST_SED.id= -e 's,\"\\\\\`,\"\\\\\`,'" \ + '' \ + '.include "prepare-subst.mk"' \ + '.include "mk/subst.mk"' + create_file_lines "file" \ + 'from`' + + run_bmake "testcase.mk" "subst-id" 1> "$tmpdir/out" 2>&1 \ + && exitcode=0 || exitcode=$? + + assert_that "out" --file-is-lines \ + '=> Substituting "id" in file' \ + 'info: [subst.mk:id] Nothing changed in "file".' + + test_case_end +fi |