The following commit has been merged in the master branch:
commit 332fe40caf0d95cb374e4ce9fa29066d918d9b19
Author: Guillem Jover <[email protected]>
Date:   Tue Apr 23 16:12:05 2013 +0200

    Dpkg::Arch: Make debwildcard_to_debtriplet() more robust
    
    Do not incorrectly match 'any' substrings in tuple elements. This is
    not currently a problem but it could become one if we ever get an
    architecture name with an 'any' substring on any of its components.

diff --git a/debian/changelog b/debian/changelog
index b468b38..1a1e325 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 dpkg (1.17.2) UNRELEASED; urgency=low
 
-  *
+  * Make Dpkg::Arch debwildcard_to_debtriplet() more robust by matching
+    on exact 'any' strings, instead of substrings.
 
  -- Guillem Jover <[email protected]>  Sun, 28 Jul 2013 15:06:29 +0200
 
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 8f37acb..d73e4a8 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -365,18 +365,19 @@ sub gnutriplet_to_debarch($)
 
 sub debwildcard_to_debtriplet($)
 {
-    local ($_) = @_;
+    my ($arch) = @_;
+    my @tuple = split /-/, $arch, 3;
 
-    if (/any/) {
-       if (/^([^-]*)-([^-]*)-(.*)/) {
-           return ($1, $2, $3);
-       } elsif (/^([^-]*)-([^-]*)$/) {
-           return ('any', $1, $2);
+    if (any { $_ eq 'any' } @tuple) {
+       if (scalar @tuple == 3) {
+           return @tuple;
+       } elsif (scalar @tuple == 2) {
+           return ('any', @tuple);
        } else {
-           return ($_, $_, $_);
+           return ('any', 'any', 'any');
        }
     } else {
-       return debarch_to_debtriplet($_);
+       return debarch_to_debtriplet($arch);
     }
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to