Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wagoodman
Copy link
Contributor

This PR makes a few fixes:

  • only closes the sbom.Writer when there are errors opening files (I missed an if statement on the port)
  • perform tilde-expansion for any user-provided paths in the application config
  • add CLI tests that assert the content for files created with -o and --file options

Closes #874

@wagoodman wagoodman requested a review from a team March 8, 2022 14:59
@wagoodman wagoodman self-assigned this Mar 8, 2022
Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; only concern is could the homedir thing fail to expand the dir but for some reason it would open with os.Open -- network drives? odd mounts?

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

Benchmark Test Results

Benchmark results from the latest changes vs base branch
name                                                       old time/op    new time/op    delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2              1.62ms ± 2%    1.36ms ± 4%  -16.37%  (p=0.008 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2            4.17ms ±11%    3.32ms ± 1%  -20.33%  (p=0.016 n=5+4)
ImagePackageCatalogers/php-composer-installed-cataloger-2    1.34ms ± 1%    1.10ms ± 3%  -18.27%  (p=0.008 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2        1.01ms ± 3%    0.81ms ± 4%  -19.38%  (p=0.008 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                    1.18ms ± 3%    0.96ms ± 4%  -18.69%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpmdb-cataloger-2                     1.01ms ± 2%    0.85ms ± 3%  -16.22%  (p=0.008 n=5+5)
ImagePackageCatalogers/java-cataloger-2                      25.4ms ± 4%    23.0ms ± 3%   -9.56%  (p=0.008 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                     1.49ms ± 3%    1.33ms ± 5%  -10.65%  (p=0.008 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2          2.23µs ± 2%    2.04µs ± 1%   -8.26%  (p=0.008 n=5+5)

name                                                       old alloc/op   new alloc/op   delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2               260kB ± 0%     259kB ± 0%   -0.11%  (p=0.032 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2            1.12MB ± 0%    1.12MB ± 0%     ~     (p=0.421 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2     267kB ± 0%     266kB ± 0%   -0.16%  (p=0.016 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2         210kB ± 0%     209kB ± 0%   -0.14%  (p=0.016 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                     257kB ± 0%     257kB ± 0%     ~     (p=0.103 n=5+5)
ImagePackageCatalogers/rpmdb-cataloger-2                      237kB ± 0%     237kB ± 0%   -0.15%  (p=0.008 n=5+5)
ImagePackageCatalogers/java-cataloger-2                      4.22MB ± 0%    4.22MB ± 0%     ~     (p=0.151 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                     1.31MB ± 0%    1.31MB ± 0%     ~     (p=0.095 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2            608B ± 0%      608B ± 0%     ~     (all equal)

name                                                       old allocs/op  new allocs/op  delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2               6.61k ± 0%     6.61k ± 0%     ~     (all equal)
ImagePackageCatalogers/python-package-cataloger-2             23.6k ± 0%     23.6k ± 0%     ~     (p=0.683 n=5+5)
ImagePackageCatalogers/php-composer-installed-cataloger-2     7.70k ± 0%     7.70k ± 0%     ~     (p=1.000 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2         5.42k ± 0%     5.42k ± 0%     ~     (all equal)
ImagePackageCatalogers/dpkgdb-cataloger-2                     7.19k ± 0%     7.19k ± 0%     ~     (all equal)
ImagePackageCatalogers/rpmdb-cataloger-2                      6.86k ± 0%     6.86k ± 0%     ~     (all equal)
ImagePackageCatalogers/java-cataloger-2                       88.4k ± 0%     88.4k ± 0%     ~     (p=0.738 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                      7.76k ± 0%     7.76k ± 0%     ~     (all equal)
ImagePackageCatalogers/go-module-binary-cataloger-2            14.0 ± 0%      14.0 ± 0%     ~     (all equal)

Signed-off-by: Alex Goodman <[email protected]>
@wagoodman wagoodman enabled auto-merge (squash) March 8, 2022 15:27
@wagoodman wagoodman merged commit 07d3c9a into main Mar 8, 2022
@wagoodman wagoodman deleted the fix-file-output branch March 8, 2022 15:37
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Writing report file fails (json/cyclonedx json)

2 participants