fix: Improve detection of erlang binary in alpine Linux (#3839)

Signed-off-by: Oleksandr Vodotiiets <alex.vodotiiets@gmail.com>
Signed-off-by: Oleksandr Vodotiiets <61548316+avodotiiets@users.noreply.github.com>
This commit is contained in:
Oleksandr Vodotiiets 2025-04-30 21:50:12 +03:00 committed by GitHub
parent 09c3b7cbea
commit 78ef2cf53b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 0 deletions

View File

@ -1067,6 +1067,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("erlang-alpine-binary"), Metadata: metadata("erlang-alpine-binary"),
}, },
}, },
{
logicalFixture: "erlang/26.1.2/linux-arm64",
expected: pkg.Package{
Name: "erlang",
Version: "26.1.2",
Type: "binary",
PURL: "pkg:generic/erlang@26.1.2",
Locations: locations("beam.smp"),
Metadata: metadata("erlang-alpine-binary"),
},
},
{ {
logicalFixture: "swipl/9.3.8/linux-amd64", logicalFixture: "swipl/9.3.8/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{

View File

@ -426,6 +426,10 @@ func DefaultClassifiers() []Classifier {
// <artificial>[NUL]/usr/local/src/otp-25.3.2.7/erts/ // <artificial>[NUL]/usr/local/src/otp-25.3.2.7/erts/
`(?m)/usr/local/src/otp-(?P<version>[0-9]+\.[0-9]+(\.[0-9]+){0,2}(-rc[0-9])?)/erts/`, `(?m)/usr/local/src/otp-(?P<version>[0-9]+\.[0-9]+(\.[0-9]+){0,2}(-rc[0-9])?)/erts/`,
), ),
FileContentsVersionMatcher(
// [NUL][NUL]26.1.2[NUL][NUL][NUL][NUL][NUL][NUL][NUL]NUL[NUL][NUL]Erlang/OTP
`\x00+(?P<version>[0-9]+\.[0-9]+(\.[0-9]+){0,2}(-rc[0-9])?)\x00+Erlang/OTP`,
),
), ),
Package: "erlang", Package: "erlang",
PURL: mustPURL("pkg:generic/erlang@version"), PURL: mustPURL("pkg:generic/erlang@version"),

View File

@ -71,6 +71,14 @@ from-images:
paths: paths:
- /usr/local/lib/erlang/erts-15.0/bin/beam.smp - /usr/local/lib/erlang/erts-15.0/bin/beam.smp
- name: erlang
version: 26.1.2
images:
- ref: hexpm/elixir:1.15.6-erlang-26.1.2-alpine-3.18.4@sha256:e84f6667f4e3d2fe00fcdb9d1c2cdd614733296c39b20b28b092743f1161bc11
platform: linux/arm64
paths:
- /usr/local/lib/erlang/erts-14.1.1/bin/beam.smp
- version: 9.3.8 - version: 9.3.8
images: images:
- ref: swipl:9.3.8@sha256:6a15e6a03afe943228924a5502ba763e653ff28d9b3391e2b3e1fc3e991f37d4 - ref: swipl:9.3.8@sha256:6a15e6a03afe943228924a5502ba763e653ff28d9b3391e2b3e1fc3e991f37d4