From: Andrew Lee (李健秋) Date: Jun, 19 2026 08:56:54 +0200 Subject: [PATCH] Replace dead lzmadec with github.com/bodgit/sevenzip Due to github.com/kjk/lzmadec not exist anymore. Use github.com/bodgit/sevenzip as a drop-in replacement. Not sure if it works, needs test before forward to upstream. Forwarded: no --- golang-github-gopasspw-gopass-hibp-1.16.1.orig/pkg/hibp/dump/scanner.go +++ golang-github-gopasspw-gopass-hibp-1.16.1/pkg/hibp/dump/scanner.go @@ -20,7 +20,7 @@ import ( "github.com/gopasspw/gopass/pkg/debug" "github.com/gopasspw/gopass/pkg/fsutil" - "github.com/kjk/lzmadec" + "github.com/bodgit/sevenzip" ) // Scanner is a HIBP dump scanner. @@ -119,14 +119,15 @@ func isSorted(fn string) bool { }() rdr = gzr case strings.HasSuffix(fn, ".7z"): - arc, err := lzmadec.NewArchive(fn) + arc, err := sevenzip.OpenReader(fn) if err != nil { return false } - if len(arc.Entries) < 1 { + defer arc.Close() + if len(arc.File) < 1 { return false } - rzr, err := arc.GetFileReader(arc.Entries[0].Path) + rzr, err := arc.File[0].Open() if err != nil { return false } @@ -185,24 +186,27 @@ func (s *Scanner) scanSortedFile(ctx con }() rdr = gzr case strings.HasSuffix(fn, ".7z"): - arc, err := lzmadec.NewArchive(fn) + arc, err := sevenzip.OpenReader(fn) if err != nil { fmt.Printf("Failed to open the file with 7z %s: %s", fn, err) return } - if len(arc.Entries) < 1 { + if len(arc.File) < 1 { + arc.Close() fmt.Printf("7z archive %s contains no entries", fn) return } - rzr, err := arc.GetFileReader(arc.Entries[0].Path) + rzr, err := arc.File[0].Open() if err != nil { - fmt.Printf("Failed open %s in %s for reading: %s", arc.Entries[0].Path, fn, err) + arc.Close() + fmt.Printf("Failed open %s in %s for reading: %s", arc.File[0].Name, fn, err) return } defer func() { + _ = arc.Close() _ = rzr.Close() }() rdr = rzr @@ -284,24 +288,27 @@ func (s *Scanner) scanUnsortedFile(ctx c }() rdr = gzr case strings.HasSuffix(fn, ".7z"): - arc, err := lzmadec.NewArchive(fn) + arc, err := sevenzip.OpenReader(fn) if err != nil { fmt.Printf("Failed to open the file with 7z %s: %s", fn, err) return } - if len(arc.Entries) < 1 { + if len(arc.File) < 1 { + arc.Close() fmt.Printf("7z archive %s contains no entries", fn) return } - rzr, err := arc.GetFileReader(arc.Entries[0].Path) + rzr, err := arc.File[0].Open() if err != nil { - fmt.Printf("Failed open %s in %s for reading: %s", arc.Entries[0].Path, fn, err) + arc.Close() + fmt.Printf("Failed open %s in %s for reading: %s", arc.File[0].Name, fn, err) return } defer func() { + _ = arc.Close() _ = rzr.Close() }() rdr = rzr