teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame SOURCES/rpm-4.16.1.3-support-bdb-hash-v8.patch

a5e32e
From c771ae28e28b2971869b7801ffc7961f4dcb6544 Mon Sep 17 00:00:00 2001
a5e32e
From: Panu Matilainen <pmatilai@redhat.com>
a5e32e
Date: Thu, 10 Jun 2021 10:32:12 +0300
a5e32e
Subject: [PATCH] Support hash v8 databases from BDB < 4.6 in bdb_ro
a5e32e
a5e32e
In Hash v8 databases page type differs from newer ones to denote
a5e32e
the difference between sorted and unsorted pages.
a5e32e
a5e32e
Fixes reading rpm databases from older distros like SLES 11 and RHEL 5
a5e32e
(RhBug:1965147)
a5e32e
---
a5e32e
 lib/backend/bdb_ro.c | 4 ++--
a5e32e
 1 file changed, 2 insertions(+), 2 deletions(-)
a5e32e
a5e32e
diff --git a/lib/backend/bdb_ro.c b/lib/backend/bdb_ro.c
a5e32e
index 2667ec845..695ef78e3 100644
a5e32e
--- a/lib/backend/bdb_ro.c
a5e32e
+++ b/lib/backend/bdb_ro.c
a5e32e
@@ -276,7 +276,7 @@ static int hash_lookup(struct bdb_cur *cur, const unsigned char *key, unsigned i
a5e32e
     pg = hash_bucket_to_page(cur->db, bucket);
a5e32e
     if (bdb_getpage(cur->db, cur->page, pg))
a5e32e
 	return -1;
a5e32e
-    if (cur->page[25] != 8 && cur->page[25] != 13)
a5e32e
+    if (cur->page[25] != 8 && cur->page[25] != 13 && cur->page[25] != 2)
a5e32e
 	return -1;
a5e32e
     cur->idx = (unsigned int)-2;
a5e32e
     cur->numidx = *(uint16_t *)(cur->page + 20);
a5e32e
@@ -323,7 +323,7 @@ static int hash_next(struct bdb_cur *cur)
a5e32e
 	    }
a5e32e
 	    if (bdb_getpage(cur->db, cur->page, pg))
a5e32e
 		return -1;
a5e32e
-	    if (cur->page[25] != 8 && cur->page[25] != 13)
a5e32e
+	    if (cur->page[25] != 8 && cur->page[25] != 13 && cur->page[25] != 2)
a5e32e
 		return -1;
a5e32e
 	    cur->numidx = *(uint16_t *)(cur->page + 20);
a5e32e
 	    continue;
a5e32e
-- 
a5e32e
2.33.1
a5e32e