Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky checks on STDIN for purl provider #2192

Closed
sfc-gh-ylefloch opened this issue Oct 15, 2024 · 1 comment · Fixed by #2223
Closed

Flaky checks on STDIN for purl provider #2192

sfc-gh-ylefloch opened this issue Oct 15, 2024 · 1 comment · Fixed by #2223
Assignees
Labels
bug Something isn't working

Comments

@sfc-gh-ylefloch
Copy link

What happened:

I tried to run Grype for a single package coming from stdin:

> echo "pkg:rpm/some-rpm" | grype purl:/dev/stdin
failed to catalog: purl file is empty: /dev/stdin

This works on OSX, but not in a Linux container.

What you expected to happen:

The scanning happens as normal on all platforms.

How to reproduce it (as minimally and precisely as possible):

Running the example command above on Linux.

Anything else we need to know?:

That is the same problem as there: golang/go#62392 (comment)

Because there is a check in Grype for the size of the input file, which could be stdin. The behaviour of Size() is system-dependent according to the std docs.

I recommend getting rid of fileHasContent() entirely, since it's only used by the purl provider and doesn't have a reliable behaviour.

Environment:

  • Output of grype version for OSX:
Application:         grype
Version:             0.82.0
BuildDate:           2024-10-07T21:20:18Z
GitCommit:           brew
GitDescription:      [not provided]
Platform:            darwin/arm64
GoVersion:           go1.23.2
Compiler:            gc
Syft Version:        v1.14.0
Supported DB Schema: 5
  • Output of grype version for Linux:
Application:         grype
Version:             0.82.0
BuildDate:           2024-10-07T21:36:44Z
GitCommit:           6b09bb857564cd3c59c0cc1b6ea997c5ee198b6d
GitDescription:      v0.82.0
Platform:            linux/amd64
GoVersion:           go1.23.2
Compiler:            gc
Syft Version:        v1.14.0
Supported DB Schema: 5
  • OS (e.g: cat /etc/os-release or similar): OSX 14.6.1 / Debian 12
@sfc-gh-ylefloch sfc-gh-ylefloch added the bug Something isn't working label Oct 15, 2024
@wagoodman wagoodman moved this to Ready in OSS Oct 21, 2024
@wagoodman wagoodman self-assigned this Oct 21, 2024
@wagoodman wagoodman moved this from Ready to In Progress in OSS Oct 21, 2024
@wagoodman wagoodman moved this from In Progress to In Review in OSS Oct 30, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in OSS Oct 30, 2024
@sfc-gh-ylefloch
Copy link
Author

Thank you @wagoodman 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants