mirror of
https://github.com/anchore/syft.git
synced 2026-08-19 08:38:25 +02:00
Fix panic on cabal.project.freeze 'installed' boot-lib constraints (#5040)
GHC boot-lib constraints (any.base installed) have no ' ==', so fields[1] panicked with index out of range and the recover dropped all Haskell packages. Skip constraint lines without a version. Signed-off-by: Synvoya <16019863+Synvoya@users.noreply.github.com> Co-authored-by: Synvoya <16019863+Synvoya@users.noreply.github.com>
This commit is contained in:
parent
7745e450fa
commit
3cc3ecb003
@ -45,6 +45,10 @@ func parseCabalFreeze(_ context.Context, _ file.Resolver, _ *generic.Environment
|
||||
|
||||
line = line[startPkgEncoding:endPkgEncoding]
|
||||
fields := strings.Split(line, " ==")
|
||||
// skip constraints without a version (e.g. GHC boot libs: "any.base installed")
|
||||
if len(fields) < 2 {
|
||||
continue
|
||||
}
|
||||
|
||||
pkgName, pkgVersion := fields[0], fields[1]
|
||||
pkgs = append(
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
active-repositories: hackage.haskell.org:merge
|
||||
constraints: any.Cabal ==3.2.1.0,
|
||||
any.array installed,
|
||||
any.base installed,
|
||||
any.Diff ==0.4.1,
|
||||
any.HTTP ==4000.3.16,
|
||||
any.HUnit ==1.6.2.0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user