Projects STRLCPY syft Commits cc0a376a
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    Makefile
    skipped 251 lines
    252 252   cd test/install && \
    253 253   make ci-test-mac
    254 254   
     255 +.PHONY: generate-compare-file
     256 +generate-compare-file:
     257 + $(call title,Generating compare test file)
     258 + go run ./cmd/syft $(COMPARE_TEST_IMAGE) -o json > $(COMPARE_DIR)/test-fixtures/acceptance-centos-8.2.2004.json
     259 + 
    255 260  # note: we cannot clean the snapshot directory since the pipeline builds the snapshot separately
    256 261  .PHONY: compare-mac
    257 262  compare-mac: $(TEMP_DIR) $(SNAPSHOT_DIR) ## Run compare tests on build snapshot binaries and packages (Mac)
    skipped 126 lines
  • ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/cataloger_test.go
    skipped 291 lines
    292 292   fixtureDir: "test-fixtures/classifiers/positive/python-binary-lib-3.7",
    293 293   expected: pkg.Package{
    294 294   Name: "python",
    295  - Version: "3.7.4a-vZ9",
    296  - PURL: "pkg:generic/[email protected].4a-vZ9",
     295 + Version: "3.7.4",
     296 + PURL: "pkg:generic/[email protected].4",
    297 297   Locations: locations("libpython3.7.so"),
    298 298   Metadata: metadata("python-binary-lib"),
    299 299   },
    skipped 45 lines
    345 345   match("python-binary", "python3.9"),
    346 346   },
    347 347   },
     348 + },
     349 + },
     350 + {
     351 + name: "positive-python-binary-3.4-alpine",
     352 + fixtureDir: "test-fixtures/classifiers/dynamic/python-binary-3.4-alpine",
     353 + expected: pkg.Package{
     354 + Name: "python",
     355 + Version: "3.4.10",
     356 + PURL: "pkg:generic/[email protected]",
     357 + Locations: locations("python3.4", "libpython3.4m.so.1.0"),
     358 + Metadata: pkg.BinaryMetadata{
     359 + Matches: []pkg.ClassifierMatch{
     360 + match("python-binary", "python3.4"),
     361 + match("python-binary", "libpython3.4m.so.1.0"),
     362 + match("python-binary-lib", "libpython3.4m.so.1.0"),
     363 + },
     364 + },
     365 + },
     366 + },
     367 + {
     368 + name: "positive-python-3.5-with-incorrect-match",
     369 + fixtureDir: "test-fixtures/classifiers/positive/python-3.5-with-incorrect-match",
     370 + expected: pkg.Package{
     371 + Name: "python",
     372 + Version: "3.5.3",
     373 + PURL: "pkg:generic/[email protected]",
     374 + Locations: locations("python3.5"),
     375 + Metadata: metadata("python-binary"),
    348 376   },
    349 377   },
    350 378   {
    skipped 225 lines
    576 604   packages, _, err := c.Catalog(resolver)
    577 605   require.NoError(t, err)
    578 606   
    579  - for _, p := range packages {
    580  - assertPackagesAreEqual(t, test.expected, p)
    581  - }
     607 + require.Len(t, packages, 1)
     608 + 
     609 + assertPackagesAreEqual(t, test.expected, packages[0])
    582 610   })
    583 611   }
    584 612  }
    skipped 229 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/classifier.go
    skipped 8 lines
    9 9   "io"
    10 10   "reflect"
    11 11   "regexp"
     12 + "strings"
    12 13   "text/template"
    13 14   
    14 15   "github.com/anchore/packageurl-go"
    skipped 63 lines
    78 79   }
    79 80   
    80 81   filepathNamedGroupValues := internal.MatchNamedCaptureGroups(pat, location.RealPath)
     82 + 
     83 + // versions like 3.5 should not match any character, but explicit dot
     84 + for k, v := range filepathNamedGroupValues {
     85 + filepathNamedGroupValues[k] = strings.ReplaceAll(v, ".", "\\.")
     86 + }
    81 87   
    82 88   tmpl, err := template.New("").Parse(contentTemplate)
    83 89   if err != nil {
    skipped 208 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/default_classifiers.go
    skipped 11 lines
    12 12   EvidenceMatcher: evidenceMatchers(
    13 13   // try to find version information from libpython shared libraries
    14 14   sharedLibraryLookup(
    15  - `^libpython[0-9]+(?:\.[0-9]+)+\.so.*$`,
     15 + `^libpython[0-9]+(?:\.[0-9]+)+[a-z]?\.so.*$`,
    16 16   libpythonMatcher),
    17 17   // check for version information in the binary
    18 18   fileNameTemplateVersionMatcher(
    skipped 221 lines
    240 240  var pythonVersionTemplate = `(?m)\x00(?P<version>{{ .version }}[-._a-zA-Z0-9]*)\x00`
    241 241   
    242 242  var libpythonMatcher = fileNameTemplateVersionMatcher(
    243  - `(?:.*/|^)libpython(?P<version>[0-9]+(?:\.[0-9]+)+)\.so.*$`,
     243 + `(?:.*/|^)libpython(?P<version>[0-9]+(?:\.[0-9]+)+)[a-z]?\.so.*$`,
    244 244   pythonVersionTemplate,
    245 245  )
    246 246   
    skipped 5 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/test-fixtures/Makefile
    skipped 2 lines
    3 3   classifiers/dynamic/python-binary-shared-lib-3.11 \
    4 4   classifiers/dynamic/python-binary-shared-lib-redhat-3.9 \
    5 5   classifiers/dynamic/python-binary-with-version-3.9 \
     6 + classifiers/dynamic/python-binary-3.4-alpine \
    6 7   classifiers/dynamic/ruby-library-3.2.1 \
    7 8   classifiers/dynamic/ruby-library-2.7.7
    8 9   
    skipped 20 lines
    29 30   ./get-image-file.sh $($@_image) \
    30 31   /usr/bin/python3.9 \
    31 32   $@/python3.9
     33 + 
     34 +classifiers/dynamic/python-binary-3.4-alpine:
     35 + $(eval $@_image := "python:3.4-alpine@sha256:c210b660e2ea553a7afa23b41a6ed112f85dbce25cbcb567c75dfe05342a4c4b")
     36 + ./get-image-file.sh $($@_image) \
     37 + /usr/local/bin/python3.4 \
     38 + $@/python3.4
     39 + ./get-image-file.sh $($@_image) \
     40 + /usr/local/lib/libpython3.4m.so.1.0 \
     41 + $@/libpython3.4m.so.1.0
    32 42   
    33 43  classifiers/dynamic/ruby-library-3.2.1:
    34 44   $(eval $@_image := "ruby:3.2.1-bullseye@sha256:b4a140656b0c5d26c0a80559b228b4d343f3fdbf56682fcbe88f6db1fa9afa6b")
    skipped 31 lines
  • syft/pkg/cataloger/binary/test-fixtures/classifiers/positive/python-3.5-with-incorrect-match/python3.5
    Binary file.
  • syft/pkg/cataloger/binary/test-fixtures/classifiers/positive/python-binary-lib-3.7/libpython3.7.so
    Binary file.
  • test/compare/test-fixtures/acceptance-centos-8.2.2004.json
    Unable to diff as the file is too large.
Please wait...
Page is in error, reload to recover