pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk/misc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sat Sep 12 20:48:13 UTC 2020

Modified Files:
        pkgsrc/mk/misc: show.mk

Log Message:
show-all: fix escaping of '$' in variable modifiers

The previous code relied on the exact implementation of Var_Parse in
bmake, and that it does not issue any error messages in case of $$ in
variable modifiers.

In variable modifiers, a $ is escaped using \$, not $$, as documented in
the manual page.

At the time when I wrote the previous version with the _SHOW_ALL.d4 and
_SHOW_ALL.d8 hacks, I did not know about the backslash escaping rule,
and I just added dollar signs until everything seemed to work.  I
couldn't explain why it worked though, which is not surprising since the
code was using an undocumented implementation flaw of bmake.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 pkgsrc/mk/misc/show.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/misc/show.mk
diff -u pkgsrc/mk/misc/show.mk:1.23 pkgsrc/mk/misc/show.mk:1.24
--- pkgsrc/mk/misc/show.mk:1.23 Sat Jul  4 18:08:35 2020
+++ pkgsrc/mk/misc/show.mk      Sat Sep 12 20:48:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: show.mk,v 1.23 2020/07/04 18:08:35 rillig Exp $
+# $NetBSD: show.mk,v 1.24 2020/09/12 20:48:13 rillig Exp $
 #
 # This file contains some targets that print information gathered from
 # variables. They do not modify any variables.
@@ -166,9 +166,6 @@ show-all: show-all-${g}
 # using the :sh modifier may show warnings, for example because ${WRKDIR}
 # doesn't exist.
 
-_SHOW_ALL.d4=  $$$$            # see regress/infra-unittests/show-all.sh
-_SHOW_ALL.d8=  $$$$$$$$        # see regress/infra-unittests/show-all.sh
-
 show-all-${g}: .PHONY
        @${RUN} printf '%s:\n' ${g:Q}
 
@@ -185,7 +182,7 @@ show-all-${g}: .PHONY
          printf '  %-6s%-${w}s # empty\n' ${_LABEL.${c}} ${v:Q}=;      \
        else                                                            \
          printf '  %-6s%-${w}s \\\n' ${_LABEL.${c}} ${v:Q}=;           \
-         printf '        %-${w}s %s \\\n' ${${v}:O:C,\\$$,${_SHOW_ALL.d8},g:@x@'' ${x:Q}@}; \
+         printf '        %-${w}s %s \\\n' ${${v}:O:C,\\\$,\$\$\$\$,g:@x@'' ${x:Q}@}; \
          printf '        %-${w}s # end of %s (sorted)\n' '' ${v:Q};    \
        fi
 
@@ -199,7 +196,7 @@ show-all-${g}: .PHONY
          printf '  %-6s%-${w}s # empty\n' ${_LABEL.${c}} ${v:Q}=;      \
        else                                                            \
          printf '  %-6s%-${w}s \\\n' ${_LABEL.${c}} ${v:Q}=;           \
-         printf '        %-${w}s %s \\\n' ${${v}:C,\\$$,${_SHOW_ALL.d8},g:@x@'' ${x:Q}@}; \
+         printf '        %-${w}s %s \\\n' ${${v}:C,\\\$,\$\$\$\$,g:@x@'' ${x:Q}@}; \
          printf '        %-${w}s # end of %s\n' '' ${v:Q};             \
        fi
 
@@ -209,7 +206,7 @@ show-all-${g}: .PHONY
        ${RUN}                                                          \
        if ${!defined(${v}) :? true : false}; then                      \
          printf '  %-6s%-${w}s # undefined\n' ${_LABEL.${c}} ${v:Q};   \
-       elif value=${${v}:U:C,\\$$,${_SHOW_ALL.d4},gW:Q} && test "x$$value" = "x"; then \
+       elif value=${${v}:U:C,\\\$,\$\$,gW:Q} && test "x$$value" = "x"; then \
          printf '  %-6s%-${w}s # empty\n' ${_LABEL.${c}} ${v:Q}=;      \
        else                                                            \
          case "$$value" in (*[\        \ ]) eol="# ends with space";; (*) eol=""; esac; \



Home | Main Index | Thread Index | Old Index