summaryrefslogtreecommitdiffstats
path: root/urpm/download.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-05-18 12:39:43 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-05-18 12:39:43 +0000
commitb5a3719a93a7ed0531414e342d5e6fd5aed9711e (patch)
tree73fae052c24f65654a8e9bcb6f4a933ff58aab02 /urpm/download.pm
parent740ba83b28c56c99211df2e551eaef9e28e39827 (diff)
downloadurpmi-b5a3719a93a7ed0531414e342d5e6fd5aed9711e.tar
urpmi-b5a3719a93a7ed0531414e342d5e6fd5aed9711e.tar.gz
urpmi-b5a3719a93a7ed0531414e342d5e6fd5aed9711e.tar.bz2
urpmi-b5a3719a93a7ed0531414e342d5e6fd5aed9711e.tar.xz
urpmi-b5a3719a93a7ed0531414e342d5e6fd5aed9711e.zip
- urpmi
o fix "Argument list too long" when calling curl/wget/proz (things should work even in case of one big transaction) (#30848)
Diffstat (limited to 'urpm/download.pm')
-rw-r--r--urpm/download.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index 255dee77..d34f1078 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -690,7 +690,14 @@ sub _sync_webfetch_raw {
}
}
my $sync = $urpm::download::{"sync_$preferred"} or die N("no webfetch found, supported webfetch are: %s\n", join(", ", urpm::download::ftp_http_downloaders()));
- $sync->($options, @{$files{ftp} || []}, @{$files{http} || []}, @{$files{https} || []});
+ my @l = (@{$files{ftp} || []}, @{$files{http} || []}, @{$files{https} || []});
+ while (@l) {
+ my $half_MAX_ARG = 131072 / 2;
+ # restrict the number of elements so that it fits on cmdline of curl/wget/proz
+ my $n = 0;
+ for (my $len = 0; $n < @l && $len < $half_MAX_ARG; $len += length($l[$n++])) {}
+ $sync->($options, splice(@l, 0, $n));
+ }
delete @files{qw(ftp http https)};
}