From ede3cf04104a5d21cb2973ce6ab849e8ccd66aa3 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 7 Feb 2014 16:08:40 +0000 Subject: pkgdetails_perl: Only interpret percentages following whitespace, to cope with GNU wget outputting the local file name (which may contain "%" due to URL-encoding) after it finishes the download (LP: #1172101). --- debian/changelog | 8 ++++++++ functions | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a5d1e8b..819b0a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +debootstrap (1.0.57) UNRELEASED; urgency=medium + + * pkgdetails_perl: Only interpret percentages following whitespace, to + cope with GNU wget outputting the local file name (which may contain "%" + due to URL-encoding) after it finishes the download (LP: #1172101). + + -- Colin Watson Fri, 07 Feb 2014 16:05:59 +0000 + debootstrap (1.0.56) unstable; urgency=low [ Tollef Fog Heen ] diff --git a/functions b/functions index 0619261..4e3955a 100644 --- a/functions +++ b/functions @@ -1138,15 +1138,19 @@ for $v (keys %fields) { shift; perl -e ' $v = 0; +$allow_percentage = 0; while (read STDIN, $x, 1) { - if ($x =~ m/\d/) { + if ($x =~ m/\s/) { + $allow_percentage = 1; + } elsif ($allow_percentage and $x =~ m/\d/) { $v *= 10; $v += $x; - } elsif ($x eq "%") { + } elsif ($allow_percentage and $x eq "%") { printf "P: %d %d%s\n", int($v / 100.0 * ($ARGV[1] - $ARGV[0]) + $ARGV[0]), $ARGV[2], ($#ARGV == 3 ? " $ARGV[3]" : ""); $v = 0; } else { $v = 0; + $allow_percentage = 0; } }' "$@" elif [ "$1" = "GETDEPS" ]; then -- cgit v0.12