Skip to content

Flaky checks on STDIN for purl provider #2192

Closed
@sfc-gh-ylefloch

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status

    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions