Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion syft/pkg/cataloger/rpm/file_cataloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/sassoftware/go-rpmutils"

"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/pkg"
Expand All @@ -28,6 +29,8 @@ func (c *FileCataloger) Name() string {
}

// Catalog is given an object to resolve file references and content, this function returns any discovered Packages after analyzing rpm files
//
//nolint:funlen
func (c *FileCataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []artifact.Relationship, error) {
fileMatches, err := resolver.FilesByGlob("**/*.rpm")
if err != nil {
Expand All @@ -43,7 +46,8 @@ func (c *FileCataloger) Catalog(resolver source.FileResolver) ([]pkg.Package, []

rpm, err := rpmutils.ReadRpm(contentReader)
if err != nil {
return nil, nil, err
log.Debugf("RPM file found but unable to read: %s (%v)", location.RealPath, err)
continue
}

nevra, err := rpm.Header.GetNEVRA()
Expand Down
3 changes: 3 additions & 0 deletions syft/pkg/cataloger/rpm/file_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func TestParseRpmFiles(t *testing.T) {
},
},
},
{
fixture: "test-fixtures/bad",
},
}

for _, test := range tests {
Expand Down
1 change: 1 addition & 0 deletions syft/pkg/cataloger/rpm/test-fixtures/bad/bad.rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is not a real RPM file