From b5a3719a93a7ed0531414e342d5e6fd5aed9711e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 18 May 2007 12:39:43 +0000 Subject: - urpmi o fix "Argument list too long" when calling curl/wget/proz (things should work even in case of one big transaction) (#30848) --- urpm/download.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'urpm') 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)}; } -- cgit v1.2.1