]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Do not delete RPP files if snapshot is already exploded
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 27 Apr 2026 21:37:47 +0000 (15:37 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 27 Apr 2026 21:37:47 +0000 (15:37 -0600)
There are situations in which the code might find itself attempting
to explode a snapshot a second time during a validation run.

The code was noticing this, and thus skipping the second download.
But by then, the cached files were already deleted. Which resulted
in the validation code receiving zero files as input.

src/rrdp.c

index 4d5355b6d9cb986217a306f21e78e58d530e6a51..684b4aaae8b27f0f64f35c3c35057e9a48429480 100644 (file)
@@ -871,28 +871,27 @@ handle_snapshot(struct update_notification *notif)
 {
        struct validation *state;
        struct rpki_uri *uri;
+       bool changed;
        int error;
 
        state = state_retrieve();
-
-       delete_rpp(tal_get_file_name(validation_tal(state)), notif->uri);
-
        uri = notif->snapshot.uri;
 
        pr_val_debug("Processing snapshot '%s'.", uri_val_get_printable(uri));
        fnstack_push_uri(uri);
 
        /*
-        * TODO (performance) Is there a point in caching the snapshot?
-        * Especially considering we delete it 4 lines afterwards.
-        * Maybe stream it instead.
-        * Same for deltas.
+        * TODO (performance) There's no point in caching the snapshot.
+        * Stream it instead. Same for deltas.
         */
-       error = cache_download(validation_cache(state), uri, NULL);
+       error = cache_download(validation_cache(state), uri, &changed);
        if (error)
                goto end;
-       error = parse_snapshot(notif);
-       delete_file(uri);
+       if (changed) {
+               delete_rpp(tal_get_file_name(validation_tal(state)), notif->uri);
+               error = parse_snapshot(notif);
+               delete_file(uri);
+       }
 
 end:
        fnstack_pop();