From 6372f077580cb3fbda5ad803bf42b8431f75351c Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Wed, 15 Apr 2026 12:41:04 -0500 Subject: [PATCH] bdb: support UNSORTED_HASH databases I saw this error being tripped somewhere that I now can't find. I think this should be find to do, as the code doesn't rely on ordering in any way: it simply reads out all the populated entries. Hold: Waiting for reproducer+test. Signed-off-by: Hank Donnay Change-Id: Ieb8d4a3dc6a7d411d6d7e9821f384e9d6a6a6964 --- internal/rpm/bdb/bdb.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/rpm/bdb/bdb.go b/internal/rpm/bdb/bdb.go index 53aaed6a1..b8a0a3496 100644 --- a/internal/rpm/bdb/bdb.go +++ b/internal/rpm/bdb/bdb.go @@ -381,8 +381,11 @@ func (db *PackageDB) readHashpage(pg *io.SectionReader) (hashpage, error) { if got, want := h.LSN, db.m.LSN; got != want { return h, fmt.Errorf("bdb: stale lsn: %016x != %016x", got, want) } - if got, want := h.Type, PageTypeHash; got != want { - return h, fmt.Errorf("bdb: unexpected page type: %v != %v", got, want) + switch typ := h.Type; typ { + case PageTypeHash: // OK + case PageTypeHashUnsorted: // OK + default: + return h, fmt.Errorf("bdb: unexpected page type: %v", typ) } return h, nil }