[pacman-dev] Do not download files if find_dl_candidates() fails

Message ID 20200304212532.124180-1-anatol.pomozov@gmail.com
State Accepted, archived
Headers show
Series [pacman-dev] Do not download files if find_dl_candidates() fails | expand

Commit Message

Anatol Pomozov March 4, 2020, 9:25 p.m. UTC
One reason why the function returns an error is some repo
does not have any servers.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
---
 lib/libalpm/sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allan McRae March 5, 2020, 6:25 a.m. UTC | #1
On 5/3/20 7:25 am, Anatol Pomozov wrote:
> One reason why the function returns an error is some repo
> does not have any servers.
> 
> Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>

Ack - downloading only some packages when we know there is an error is
strange behaviour.

> ---
>  lib/libalpm/sync.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> index 89cc7867..50b21b54 100644
> --- a/lib/libalpm/sync.c
> +++ b/lib/libalpm/sync.c
> @@ -787,7 +787,7 @@ static int download_files(alpm_handle_t *handle)
>  
>  	errors += find_dl_candidates(handle, &files);
>  
> -	if(files) {
> +	if(files && !errors) {
>  		/* check for necessary disk space for download */
>  		if(handle->checkspace) {
>  			off_t *file_sizes;
>

Patch

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 89cc7867..50b21b54 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -787,7 +787,7 @@  static int download_files(alpm_handle_t *handle)
 
 	errors += find_dl_candidates(handle, &files);
 
-	if(files) {
+	if(files && !errors) {
 		/* check for necessary disk space for download */
 		if(handle->checkspace) {
 			off_t *file_sizes;