[pacman-dev] [PATCH] FS#66472: Remove *.sig file if package corrupted
In case if a package corrupted (e.g. signature or hash is invalid) pacman tries to remove the package file to redownload it anew the next time. Remove *.sig file as well to make sure no data is left for the invalid package. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> --- lib/libalpm/sync.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 9350793a..9397575a 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -688,7 +688,13 @@ static int prompt_to_delete(alpm_handle_t *handle, const char *filepath, }; QUESTION(handle, &question); if(question.remove) { + char *sig_filename; + unlink(filepath); + + sig_filename = _alpm_sigpath(handle, filepath); + unlink(sig_filename); + FREE(sig_filename); } return question.remove; } -- 2.28.0
On 15/9/20 11:52 am, Anatol Pomozov wrote:
In case if a package corrupted (e.g. signature or hash is invalid) pacman tries to remove the package file to redownload it anew the next time. Remove *.sig file as well to make sure no data is left for the invalid package.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> --- lib/libalpm/sync.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 9350793a..9397575a 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -688,7 +688,13 @@ static int prompt_to_delete(alpm_handle_t *handle, const char *filepath, }; QUESTION(handle, &question); if(question.remove) { + char *sig_filename; + unlink(filepath); + + sig_filename = _alpm_sigpath(handle, filepath); + unlink(sig_filename); + FREE(sig_filename);
So... You have "filepath" and use the function "_alpm_sigpath()", and then call the variable "sig_filename". Needs to be sig_filepath! I'll change that and apply.
} return question.remove; }
Hi On Sun, Sep 20, 2020 at 6:27 PM Allan McRae <allan@archlinux.org> wrote:
On 15/9/20 11:52 am, Anatol Pomozov wrote:
In case if a package corrupted (e.g. signature or hash is invalid) pacman tries to remove the package file to redownload it anew the next time. Remove *.sig file as well to make sure no data is left for the invalid package.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> --- lib/libalpm/sync.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 9350793a..9397575a 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -688,7 +688,13 @@ static int prompt_to_delete(alpm_handle_t *handle, const char *filepath, }; QUESTION(handle, &question); if(question.remove) { + char *sig_filename; + unlink(filepath); + + sig_filename = _alpm_sigpath(handle, filepath); + unlink(sig_filename); + FREE(sig_filename);
So... You have "filepath" and use the function "_alpm_sigpath()", and then call the variable "sig_filename". Needs to be sig_filepath!
I'll change that and apply.
Sounds good to me. Thank you for doing it.
participants (2)
-
Allan McRae
-
Anatol Pomozov