Claudio Jeker([email protected]) on 2021.04.13 11:29:57 +0200:
> rpki-client applies all delta files to a temporary location. At the same
> time files or uri are tracked in a added and deleted set to know which
> files to remove from the repo or move into place.
> 
> Now when adding a file to the temp dir one step is missing. If the file
> was previously removed and then in a later delta added again the file will
> be on both the added and removed set and during merge the file will be
> removed and the rename will fail.
> 
> Btw. for the PUB_DEL case the inverse check happens earlier in
> rrdp_handle_file() since the hash of the file must be checked before
> accepting the delete. At that point files in the added set will be checked
> and removed from the set.
> 
> This issue is not common but I think I hit it once and this diff should
> take care of it.

easy enough.

ok benno@

> -- 
> :wq Claudio
> 
> Index: repo.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rpki-client/repo.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 repo.c
> --- repo.c    7 Apr 2021 14:19:31 -0000       1.4
> +++ repo.c    12 Apr 2021 17:24:34 -0000
> @@ -778,6 +778,10 @@ rrdp_handle_file(size_t id, enum publish
>       if (pt == PUB_DEL) {
>               filepath_add(&rr->deleted, uri);
>       } else {
> +             fp = filepath_find(&rr->deleted, uri);
> +             if (fp != NULL)
> +                     filepath_put(&rr->deleted, fp);
> +
>               /* add new file to temp dir */
>               if ((fn = rrdp_filename(rr, uri, 1)) == NULL)
>                       return 0;
> 

Reply via email to