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:
2026-06-23 15:14:55 +02:00
parent b69065be03
commit 0be160ebb9
3 changed files with 14 additions and 5 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
pkgname=hal pkgname=hal
pkgver=0.2.0 pkgver=0.2.0
pkgrel=2 pkgrel=3
pkgdesc="HAL 9000 — Antergos NeXT Package Manager. Dual-mode: wrapper (pacman) or native (standalone)." pkgdesc="HAL 9000 — Antergos NeXT Package Manager. Dual-mode: wrapper (pacman) or native (standalone)."
arch=('any') arch=('any')
url="https://github.com/Antergos-NeXT" url="https://github.com/Antergos-NeXT"
Binary file not shown.
+10 -1
View File
@@ -367,9 +367,18 @@ def load_sync_dbs() -> Dict[str, dict]:
for db_path in sorted(SYNC_DIR.glob("*.db")): for db_path in sorted(SYNC_DIR.glob("*.db")):
try: try:
with open(db_path, "rb") as f: 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 import zstandard
dctx = zstandard.ZstdDecompressor() 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: with tarfile.open(fileobj=reader, mode="r|") as tar:
current_dir = None current_dir = None
entry_data = {} entry_data = {}