diff --git a/syft/pkg/cataloger/alpm/parse_alpm_db.go b/syft/pkg/cataloger/alpm/parse_alpm_db.go index 98e3e56887a..5bc776a4443 100644 --- a/syft/pkg/cataloger/alpm/parse_alpm_db.go +++ b/syft/pkg/cataloger/alpm/parse_alpm_db.go @@ -42,10 +42,12 @@ func parseAlpmDB(resolver source.FileResolver, env *generic.Environment, reader if err != nil { return nil, nil, err } + pkgFiles, err := parseMtree(r) if err != nil { return nil, nil, err } + // The replace the files found the the pacman database with the files from the mtree These contain more metadata and // thus more useful. metadata.Files = pkgFiles @@ -106,6 +108,10 @@ func getFileReader(path string, resolver source.FileResolver) (io.Reader, error) if err != nil { return nil, err } + + if len(locs) == 0 { + return nil, fmt.Errorf("could not find file: %s", path) + } // TODO: Should we maybe check if we found the file dbContentReader, err := resolver.FileContentsByLocation(locs[0]) if err != nil {