[pacman-dev] [PATCH] FS#66472: Remove *.sig file if package corrupted

Anatol Pomozov anatol.pomozov at gmail.com
Tue Sep 15 01:52:56 UTC 2020


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 at 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


More information about the pacman-dev mailing list