diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2024-05-07 21:01:01 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2024-05-07 21:01:01 +0300 |
commit | d72f28015aab8ff3d9233b60a123030ce995fc76 (patch) | |
tree | 9389b21bcc833e7603ecbc73e9b81486536aad57 /pkg/portage | |
parent | anitya: add ignore for perl packages (diff) | |
download | soko-d72f28015aab8ff3d9233b60a123030ce995fc76.tar.gz soko-d72f28015aab8ff3d9233b60a123030ce995fc76.tar.bz2 soko-d72f28015aab8ff3d9233b60a123030ce995fc76.zip |
updater/mask: don't panic upon malformed files
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'pkg/portage')
-rw-r--r-- | pkg/portage/repository/deprecated.go | 3 | ||||
-rw-r--r-- | pkg/portage/repository/mask.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/portage/repository/deprecated.go b/pkg/portage/repository/deprecated.go index 594c553..ddc80a1 100644 --- a/pkg/portage/repository/deprecated.go +++ b/pkg/portage/repository/deprecated.go @@ -76,6 +76,9 @@ func parsePackagesDeprecated(entry string) { } else { reason = reason + " " + templ.EscapeString(strings.TrimPrefix(packageLine, "# ")) } + if len(packageLines) == 0 { + break + } packageLine, packageLines = packageLines[0], packageLines[1:] } diff --git a/pkg/portage/repository/mask.go b/pkg/portage/repository/mask.go index c6b500c..eddf8ec 100644 --- a/pkg/portage/repository/mask.go +++ b/pkg/portage/repository/mask.go @@ -120,6 +120,9 @@ func parsePackageMask(packageMask string) { } else { reason = reason + " " + templ.EscapeString(strings.TrimPrefix(packageMaskLine, "# ")) } + if len(packageMaskLines) == 0 { + break + } packageMaskLine, packageMaskLines = packageMaskLines[0], packageMaskLines[1:] } |