diff options
author | Guillem Jover <guillem@debian.org> | 2013-04-23 16:12:05 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2013-07-28 15:54:39 +0200 |
commit | 332fe40caf0d95cb374e4ce9fa29066d918d9b19 (patch) | |
tree | 11072d4afc5103eef1f4259f910e10c461b4336c | |
parent | 1f015c7b9f96eefcd209d85b539fff63cae30264 (diff) | |
download | dpkg-332fe40caf0d95cb374e4ce9fa29066d918d9b19.tar.gz |
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.
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | scripts/Dpkg/Arch.pm | 17 |
2 files changed, 11 insertions, 9 deletions
diff --git a/debian/changelog b/debian/changelog index b468b38de..1a1e32598 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 <guillem@debian.org> Sun, 28 Jul 2013 15:06:29 +0200 diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm index 8f37acbcc..d73e4a8cf 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); } } |