aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-05-07 21:01:01 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-05-07 21:01:01 +0300
commitd72f28015aab8ff3d9233b60a123030ce995fc76 (patch)
tree9389b21bcc833e7603ecbc73e9b81486536aad57 /pkg/portage
parentanitya: add ignore for perl packages (diff)
downloadsoko-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.go3
-rw-r--r--pkg/portage/repository/mask.go3
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:]
}