hal: fix load_sync_dbs zstd crash on live ISO
load_sync_dbs() always tried zstd decompression, but pacman stores .db files in varying formats (gzip, zstd, or decompressed). Now detects format by magic bytes: - \x28\xb5\x2f\xfd → zstd decompression - \x1f\x8b → gzip decompression - anything else → raw tar (already decompressed by hal sync) Also bumped pkgrel 2→3 to trigger rebuild.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
pkgname=hal
|
||||
pkgver=0.2.0
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
pkgdesc="HAL 9000 — Antergos NeXT Package Manager. Dual-mode: wrapper (pacman) or native (standalone)."
|
||||
arch=('any')
|
||||
url="https://github.com/Antergos-NeXT"
|
||||
|
||||
Binary file not shown.
+10
-1
@@ -367,9 +367,18 @@ def load_sync_dbs() -> Dict[str, dict]:
|
||||
for db_path in sorted(SYNC_DIR.glob("*.db")):
|
||||
try:
|
||||
with open(db_path, "rb") as f:
|
||||
header = f.read(4)
|
||||
f.seek(0)
|
||||
reader = None
|
||||
if header[:4] == b"\x28\xb5\x2f\xfd":
|
||||
import zstandard
|
||||
dctx = zstandard.ZstdDecompressor()
|
||||
with dctx.stream_reader(f) as reader:
|
||||
reader = dctx.stream_reader(f)
|
||||
elif header[:2] == b"\x1f\x8b":
|
||||
import gzip
|
||||
reader = gzip.GzipFile(fileobj=f)
|
||||
else:
|
||||
reader = f
|
||||
with tarfile.open(fileobj=reader, mode="r|") as tar:
|
||||
current_dir = None
|
||||
entry_data = {}
|
||||
|
||||
Reference in New Issue
Block a user