[pacman-dev] [PATCH] libalpm: Force update when database is marked as corrupted.

Sebastian Lackner sebastian at fds-team.de
Sat Jul 4 16:39:42 UTC 2015


We are using a CDN to distribute our packages, and it happens from time to time
that the *.db and *.db.sig files are out-of-sync. When the signature is updated
before the database file, everything is fine. However, when the database is
updated first, then libalpm will update the timestamp of the database, but leave
it in a broken state (wrong PGP signature). A force-update is required to
resolve this, which can be confusing for our users - this patch changes
alpm_db_update to trigger an update automatically when the database is invalid.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
 lib/libalpm/be_sync.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index ea979e6..68c5b43 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -196,6 +196,10 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 		return -1;
 	}
 
+	if(db->status & DB_STATUS_INVALID) {
+		force = 1;
+	}
+
 	/* make sure we have a sane umask */
 	oldmask = umask(0022);
 
-- 
2.4.5


More information about the pacman-dev mailing list