Преглед изворни кода

Properly count recursive expansion of variables, instead of just counting
all variable expansions.

Adam Heath пре 24 година
родитељ
комит
373fac4cfd
3 измењених фајлова са 11 додато и 0 уклоњено
  1. 5 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 4 0
      scripts/controllib.pl

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Fri May 24 21:49:52 CDT 2002 Adam Heath <doogie@debian.org>
+
+  * scripts/controllib.pl: Properly count recursive expansion of variables,
+    instead of just counting all variable expansions.
+
 Fri May 24 21:20:04 CDT 2002 Adam Heath <doogie@debian.org>
 Fri May 24 21:20:04 CDT 2002 Adam Heath <doogie@debian.org>
 
 
   * scripts/cl-debian.pl: Recognize emergency as valid in changelogs.
   * scripts/cl-debian.pl: Recognize emergency as valid in changelogs.

+ 2 - 0
debian/changelog

@@ -103,6 +103,8 @@ dpkg (1.10) unstable; urgency=low
     Closes: Bug#140441.
     Closes: Bug#140441.
   * cl-debian.pl now recognizes emergency as valid in changelogs.
   * cl-debian.pl now recognizes emergency as valid in changelogs.
     Closes: Bug#138013.
     Closes: Bug#138013.
+  * Properly count recursive expansion of variables, instead of just
+    counting all variable expansions.  Closes: #144121.
 
 
  -- Wichert Akkerman <wakkerma@debian.org>  Mon, 20 Aug 2001 14:54:38 +0200
  -- Wichert Akkerman <wakkerma@debian.org>  Mon, 20 Aug 2001 14:54:38 +0200
 
 

+ 4 - 0
scripts/controllib.pl

@@ -81,6 +81,10 @@ sub substvars {
     my ($lhs,$vn,$rhs,$count);
     my ($lhs,$vn,$rhs,$count);
     $count=0;
     $count=0;
     while ($v =~ m/\$\{([-:0-9a-z]+)\}/i) {
     while ($v =~ m/\$\{([-:0-9a-z]+)\}/i) {
+        # If we have consumed more from the leftover data, then
+        # reset the recursive counter.
+        $count= 0 if (length($') < length($rhs));
+
         $count < $maxsubsts ||
         $count < $maxsubsts ||
             &error("too many substitutions - recursive ? - in \`$v'");
             &error("too many substitutions - recursive ? - in \`$v'");
         $lhs=$`; $vn=$1; $rhs=$';
         $lhs=$`; $vn=$1; $rhs=$';