This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=3c7ac96f59446979557f3bc335df5229f9762aeb

commit 3c7ac96f59446979557f3bc335df5229f9762aeb
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Oct 5 16:43:37 2021 +0200

    deb-substvars(5): Document what ${} is good for
    
    This can be used as an escape sequence to inject literal «${VARIABLE}»
    into the resulting text as «${}{VARIABLE}», otherwise the recursive
    handling would replace any embedded character even if indirectly so.
    
    Prompted-by: Paul Wise <[email protected]>
---
 man/deb-substvars.pod            | 2 ++
 scripts/Dpkg/Control/HashCore.pm | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/man/deb-substvars.pod b/man/deb-substvars.pod
index 8048f1071..c8fcb4c24 100644
--- a/man/deb-substvars.pod
+++ b/man/deb-substvars.pod
@@ -55,6 +55,8 @@ B<${}>
 (which is not a legal substitution) is replaced with a
 B<$>
 sign.
+This can be used as an escape sequence such as B<${}{>I<VARIABLE>B<}> which
+will end up as B<${>I<VARIABLE>B<}> on the output.
 
 While variable substitution is done on all control fields, some of those
 fields are used and needed during the build when the substitution did not
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm
index 04a8a574b..45780206f 100644
--- a/scripts/Dpkg/Control/HashCore.pm
+++ b/scripts/Dpkg/Control/HashCore.pm
@@ -432,7 +432,10 @@ sub apply_substvars {
                $v =~ s/\s*,\s*$//;
            }
        }
-        $v =~ s/\$\{\}/\$/g; # XXX: what for?
+        # Replace ${} with $, which is otherwise an invalid substitution, but
+        # this then makes it possible to use ${} as an escape sequence such
+        # as ${}{VARIABLE}.
+        $v =~ s/\$\{\}/\$/g;
 
         $self->{$f} = $v;
     }

-- 
Dpkg.Org's dpkg

Reply via email to