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

Skip to content

Conversation

@wagoodman
Copy link
Contributor

This is the sister PR to github.com/anchore/grype/pull/484, however, since syft currently does not accept input directly there are no further changes needed. See the code comment for more details on the nature of the change.

@wagoodman wagoodman requested a review from a team October 29, 2021 15:03
@wagoodman wagoodman self-assigned this Oct 29, 2021
@github-actions
Copy link

github-actions bot commented Oct 29, 2021

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.12ms ± 1%    1.58ms ± 8%  +41.38%  (p=0.008 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2        2.45ms ± 3%    3.52ms ± 3%  +43.66%  (p=0.008 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2     735µs ± 4%     926µs ± 2%  +25.99%  (p=0.008 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                 765µs ± 2%    1015µs ± 2%  +32.63%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpmdb-cataloger-2                  786µs ± 3%     957µs ± 3%  +21.69%  (p=0.008 n=5+5)
ImagePackageCatalogers/java-cataloger-2                  11.0ms ± 4%    13.1ms ± 1%  +18.88%  (p=0.008 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                 1.01ms ± 2%    1.34ms ± 2%  +32.39%  (p=0.008 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2       561ns ± 2%     727ns ± 2%  +29.63%  (p=0.008 n=5+5)

name                                                   old alloc/op   new alloc/op   delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2           228kB ± 0%     248kB ± 0%   +9.18%  (p=0.008 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2         979kB ± 0%    1110kB ± 0%  +13.29%  (p=0.008 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2     192kB ± 0%     199kB ± 0%   +3.64%  (p=0.008 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                 211kB ± 0%     229kB ± 0%   +8.55%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpmdb-cataloger-2                  217kB ± 0%     222kB ± 0%   +2.31%  (p=0.008 n=5+5)
ImagePackageCatalogers/java-cataloger-2                  3.12MB ± 0%    3.24MB ± 0%   +3.85%  (p=0.008 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                 1.26MB ± 0%    1.29MB ± 0%   +2.78%  (p=0.008 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2        336B ± 0%      336B ± 0%     ~     (all equal)

name                                                   old allocs/op  new allocs/op  delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2           5.46k ± 0%     6.82k ± 0%  +24.92%  (p=0.008 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2         18.1k ± 0%     26.3k ± 0%  +45.07%  (p=0.008 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2     4.80k ± 0%     5.19k ± 0%   +8.19%  (p=0.008 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                 5.53k ± 0%     6.67k ± 0%  +20.65%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpmdb-cataloger-2                  6.22k ± 0%     6.56k ± 0%   +5.38%  (p=0.008 n=5+5)
ImagePackageCatalogers/java-cataloger-2                   51.5k ± 0%     59.0k ± 0%  +14.52%  (p=0.008 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                  5.49k ± 0%     7.74k ± 0%  +40.87%  (p=0.008 n=5+5)
ImagePackageCatalogers/go-module-binary-cataloger-2        9.00 ± 0%      9.00 ± 0%     ~     (all equal)

Copy link
Contributor

@luhring luhring left a comment

Choose a reason for hiding this comment

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

Thanks!


return fi.Mode()&os.ModeCharDevice == 0, nil
// note: we should NOT use the absence of a character device here as the hint that there may be input expected
// on stdin, as running grype as a subprocess you would expect no character device to be present but input can
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: grype -> syft

Signed-off-by: Christopher Angelo Phillips <[email protected]>
@spiffcs spiffcs enabled auto-merge (squash) November 2, 2021 16:34
@spiffcs spiffcs merged commit 4842847 into main Nov 2, 2021
@spiffcs spiffcs deleted the stdin-check branch November 2, 2021 16:41
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
* use named pipe bit when checking for piped input

Signed-off-by: Alex Goodman <[email protected]>
Co-authored-by: Christopher Angelo Phillips <[email protected]>
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.

3 participants