summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-07 16:08:40 (GMT)
committerColin Watson <cjwatson@debian.org>2014-02-07 16:08:40 (GMT)
commitede3cf04104a5d21cb2973ce6ab849e8ccd66aa3 (patch)
tree07c6ddcec7cf1e94fb34d58dffb354976ac9f7df /functions
parent27fff7c1de46d5215b8d75066625addf4e1a1929 (diff)
downloaddebootstrap-ede3cf04104a5d21cb2973ce6ab849e8ccd66aa3.zip
debootstrap-ede3cf04104a5d21cb2973ce6ab849e8ccd66aa3.tar.gz
debootstrap-ede3cf04104a5d21cb2973ce6ab849e8ccd66aa3.tar.bz2
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).
Diffstat (limited to 'functions')
-rw-r--r--functions8
1 files changed, 6 insertions, 2 deletions
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