[pacman-dev] [PATCH] libalpm: fix payloads not being reset between servers

Andrew Gregory andrew.gregory.8 at gmail.com
Sun Jan 17 01:36:23 UTC 2021


On 01/17/21 at 01:18am, morganamilo wrote:
> This was originally fixed in e83e868a77865d42a33076605f9a90a165f7c93a
> but removed when implementing parallel downloads.
> 
> ---
> 
> Some what untested. Just need to wait for my internet to act up again.
> 
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index df5e8be7..3a65da7f 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -367,6 +367,12 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
>  		fseek(payload->localf, 0, SEEK_SET);
>  	}
>  
> +
> +	/* reset progress for next server */
> +	payload->initial_size += payload->prevprogress;
> +	payload->prevprogress = 0;
> +	payload->unlink_on_fail = 0;
> +
>  	/* Set curl with the new URL */
>  	curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);

$ meson compile; sudo rm /tmp/pacman-5.2.2-1-x86_64.pkg.tar.zst; sudo ./pacman --cachedir /tmp -Sw pacman --noconfirm
Found runner: ['/usr/bin/ninja']
ninja: Entering directory `.'
ninja: no work to do.
rm: cannot remove '/tmp/pacman-5.2.2-1-x86_64.pkg.tar.zst': No such file or directory
resolving dependencies...

Package (1)  Old Version  New Version  Net Change  Download Size

core/pacman  5.2.2-1      5.2.2-1        0.00 MiB       0.82 MiB

Total Download Size:  0.82 MiB

:: Proceed with download? [Y/n] 
:: Retrieving packages...
 pacman-5.2.2-1-x86_64.pkg.tar.zst failed to download
error: failed retrieving file 'pacman-5.2.2-1-x86_64.pkg.tar.zst' from archmirror1.octyl.net : expected download size exceeded
warning: failed to retrieve some files
error: failed to commit transaction (download library error)
Errors occurred, no packages were upgraded.


More information about the pacman-dev mailing list