From b505317e105e3f18d2f879c45d21dc49619e7d86 Mon Sep 17 00:00:00 2001 From: Nathan Voss Date: Wed, 23 Oct 2024 07:59:28 -0700 Subject: [PATCH] Expanded dpkg cataloger globs (#3373) Signed-off-by: Nathan Voss --- syft/pkg/cataloger/debian/cataloger.go | 2 +- syft/pkg/cataloger/debian/cataloger_test.go | 4 +++- .../debian/test-fixtures/glob-paths/usr/lib/dpkg/status | 1 + .../test-fixtures/glob-paths/usr/lib/dpkg/status.d/pkg-1.0 | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status create mode 100644 syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status.d/pkg-1.0 diff --git a/syft/pkg/cataloger/debian/cataloger.go b/syft/pkg/cataloger/debian/cataloger.go index d6876981c45..393062f6580 100644 --- a/syft/pkg/cataloger/debian/cataloger.go +++ b/syft/pkg/cataloger/debian/cataloger.go @@ -14,6 +14,6 @@ func NewDBCataloger() pkg.Cataloger { return generic.NewCataloger("dpkg-db-cataloger"). // note: these globs have been intentionally split up in order to improve search performance, // please do NOT combine into: "**/var/lib/dpkg/{status,status.d/*}" - WithParserByGlobs(parseDpkgDB, "**/var/lib/dpkg/status", "**/var/lib/dpkg/status.d/*", "**/lib/opkg/info/*.control", "**/lib/opkg/status"). + WithParserByGlobs(parseDpkgDB, "**/lib/dpkg/status", "**/lib/dpkg/status.d/*", "**/lib/opkg/info/*.control", "**/lib/opkg/status"). WithProcessors(dependency.Processor(dbEntryDependencySpecifier)) } diff --git a/syft/pkg/cataloger/debian/cataloger_test.go b/syft/pkg/cataloger/debian/cataloger_test.go index 629019954fe..299d7338d44 100644 --- a/syft/pkg/cataloger/debian/cataloger_test.go +++ b/syft/pkg/cataloger/debian/cataloger_test.go @@ -234,10 +234,12 @@ func TestCataloger_Globs(t *testing.T) { name: "obtain db status files", fixture: "test-fixtures/glob-paths", expected: []string{ + "usr/lib/dpkg/status", "var/lib/dpkg/status", + "usr/lib/dpkg/status.d/pkg-1.0", "var/lib/dpkg/status.d/pkg-1.0", - "usr/lib/opkg/status", "usr/lib/opkg/info/pkg-1.0.control", + "usr/lib/opkg/status", }, }, } diff --git a/syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status b/syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status new file mode 100644 index 00000000000..90786794c1e --- /dev/null +++ b/syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status @@ -0,0 +1 @@ +bogus status \ No newline at end of file diff --git a/syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status.d/pkg-1.0 b/syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status.d/pkg-1.0 new file mode 100644 index 00000000000..b09abcf2897 --- /dev/null +++ b/syft/pkg/cataloger/debian/test-fixtures/glob-paths/usr/lib/dpkg/status.d/pkg-1.0 @@ -0,0 +1 @@ +bogus package \ No newline at end of file