| 1 |
From: Andrew Lee (李健秋) <[email protected]> |
| 2 |
Date: Jun, 19 2026 08:56:54 +0200 |
| 3 |
Subject: [PATCH] Replace dead lzmadec with github.com/bodgit/sevenzip |
| 4 |
Due to github.com/kjk/lzmadec not exist anymore. |
| 5 |
Use github.com/bodgit/sevenzip as a drop-in replacement. |
| 6 |
Not sure if it works, needs test before forward to upstream. |
| 7 |
Forwarded: no |
| 8 |
--- golang-github-gopasspw-gopass-hibp-1.16.1.orig/pkg/hibp/dump/scanner.go |
| 9 |
+++ golang-github-gopasspw-gopass-hibp-1.16.1/pkg/hibp/dump/scanner.go |
| 10 |
@@ -20,7 +20,7 @@ import ( |
| 11 |
|
| 12 |
"github.com/gopasspw/gopass/pkg/debug" |
| 13 |
"github.com/gopasspw/gopass/pkg/fsutil" |
| 14 |
- "github.com/kjk/lzmadec" |
| 15 |
+ "github.com/bodgit/sevenzip" |
| 16 |
) |
| 17 |
|
| 18 |
// Scanner is a HIBP dump scanner. |
| 19 |
@@ -119,14 +119,15 @@ func isSorted(fn string) bool { |
| 20 |
}() |
| 21 |
rdr = gzr |
| 22 |
case strings.HasSuffix(fn, ".7z"): |
| 23 |
- arc, err := lzmadec.NewArchive(fn) |
| 24 |
+ arc, err := sevenzip.OpenReader(fn) |
| 25 |
if err != nil { |
| 26 |
return false |
| 27 |
} |
| 28 |
- if len(arc.Entries) < 1 { |
| 29 |
+ defer arc.Close() |
| 30 |
+ if len(arc.File) < 1 { |
| 31 |
return false |
| 32 |
} |
| 33 |
- rzr, err := arc.GetFileReader(arc.Entries[0].Path) |
| 34 |
+ rzr, err := arc.File[0].Open() |
| 35 |
if err != nil { |
| 36 |
return false |
| 37 |
} |
| 38 |
@@ -185,24 +186,27 @@ func (s *Scanner) scanSortedFile(ctx con |
| 39 |
}() |
| 40 |
rdr = gzr |
| 41 |
case strings.HasSuffix(fn, ".7z"): |
| 42 |
- arc, err := lzmadec.NewArchive(fn) |
| 43 |
+ arc, err := sevenzip.OpenReader(fn) |
| 44 |
if err != nil { |
| 45 |
fmt.Printf("Failed to open the file with 7z %s: %s", fn, err) |
| 46 |
|
| 47 |
return |
| 48 |
} |
| 49 |
- if len(arc.Entries) < 1 { |
| 50 |
+ if len(arc.File) < 1 { |
| 51 |
+ arc.Close() |
| 52 |
fmt.Printf("7z archive %s contains no entries", fn) |
| 53 |
|
| 54 |
return |
| 55 |
} |
| 56 |
- rzr, err := arc.GetFileReader(arc.Entries[0].Path) |
| 57 |
+ rzr, err := arc.File[0].Open() |
| 58 |
if err != nil { |
| 59 |
- fmt.Printf("Failed open %s in %s for reading: %s", arc.Entries[0].Path, fn, err) |
| 60 |
+ arc.Close() |
| 61 |
+ fmt.Printf("Failed open %s in %s for reading: %s", arc.File[0].Name, fn, err) |
| 62 |
|
| 63 |
return |
| 64 |
} |
| 65 |
defer func() { |
| 66 |
+ _ = arc.Close() |
| 67 |
_ = rzr.Close() |
| 68 |
}() |
| 69 |
rdr = rzr |
| 70 |
@@ -284,24 +288,27 @@ func (s *Scanner) scanUnsortedFile(ctx c |
| 71 |
}() |
| 72 |
rdr = gzr |
| 73 |
case strings.HasSuffix(fn, ".7z"): |
| 74 |
- arc, err := lzmadec.NewArchive(fn) |
| 75 |
+ arc, err := sevenzip.OpenReader(fn) |
| 76 |
if err != nil { |
| 77 |
fmt.Printf("Failed to open the file with 7z %s: %s", fn, err) |
| 78 |
|
| 79 |
return |
| 80 |
} |
| 81 |
- if len(arc.Entries) < 1 { |
| 82 |
+ if len(arc.File) < 1 { |
| 83 |
+ arc.Close() |
| 84 |
fmt.Printf("7z archive %s contains no entries", fn) |
| 85 |
|
| 86 |
return |
| 87 |
} |
| 88 |
- rzr, err := arc.GetFileReader(arc.Entries[0].Path) |
| 89 |
+ rzr, err := arc.File[0].Open() |
| 90 |
if err != nil { |
| 91 |
- fmt.Printf("Failed open %s in %s for reading: %s", arc.Entries[0].Path, fn, err) |
| 92 |
+ arc.Close() |
| 93 |
+ fmt.Printf("Failed open %s in %s for reading: %s", arc.File[0].Name, fn, err) |
| 94 |
|
| 95 |
return |
| 96 |
} |
| 97 |
defer func() { |
| 98 |
+ _ = arc.Close() |
| 99 |
_ = rzr.Close() |
| 100 |
}() |
| 101 |
rdr = rzr |