]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod-client.c: Skip negative cache entry for cancelled downloads
authorAaron Merey <amerey@redhat.com>
Sun, 10 Aug 2025 19:25:17 +0000 (15:25 -0400)
committerAaron Merey <amerey@redhat.com>
Mon, 11 Aug 2025 15:54:42 +0000 (11:54 -0400)
The debuginfod client cache uses empty files to indicate that a download
was unsuccessful and should not be attempted again.

Commit 5527216460c61 skips the creation of empty files when a downloaded
is cancelled by the user.  This works by setting
client->progressfn_cancel to true when progressfn returns a non-zero value.

Commit d47d93b1049ec appears to have accidentally removed this setting of
client->progressfn_cancel.

Restore setting client->progressfn_cancel to true when progressfn
returns a non-zero value.  Also set client->progressfn_cancel to false
at the beginning of debuginfod_find_metadata to avoid previous
cancellations affecting the current metadata query.

Signed-off-by: Aaron Merey <amerey@redhat.com>
debuginfod/debuginfod-client.c

index 3c3a88d17d80cece1bb32d53f1c0a65f3851d468..f7d125615d735f49d235530112b55d1d2e69c5d8 100644 (file)
@@ -1182,7 +1182,10 @@ perform_queries(CURLM *curlm, CURL **target_handle, struct handle_data *data, de
                 }
               
               if ((*c->progressfn) (c, pa, dl_size == -1 ? 0 : dl_size))
-                break;
+               {
+                 c->progressfn_cancel = true;
+                 break;
+               }
             }
         }
       /* Check to see if we are downloading something which exceeds maxsize, if set.*/
@@ -2734,6 +2737,8 @@ int debuginfod_find_metadata (debuginfod_client *client,
   int rc = 0, r;
   int vfd = client->verbose_fd;
   struct handle_data *data = NULL;
+
+  client->progressfn_cancel = false;
   
   json_object *json_metadata = json_object_new_object();
   json_bool json_metadata_complete = true;