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

Skip to content

Conversation

@wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Oct 28, 2021

Today if you run grype as a subprocess you may see it hang forever. This is due to grype waiting for input in stdin in cases when it shouldn't be. This PR makes two changes:

  1. Use the FIFO (named pipe) mode bit to be set on stdin as an indicator of bytes could be expected on stdin (not the absence of a character device)
  2. If the CLI hints at input coming from elsewhere (not stdin) then stdin is ignored

Additional changes were made that were related:

  1. Removes the grype supplied code for unmarshaling Syft JSON. This is now provided by Syft format decode capabilities for all SBOM formats (more formats being implemented soon)
  2. Removes the provider abstraction since Syft will be providing SBOM decoding capabilities, not grype.

This addresses a regression from v0.23.0 to v0.24.0 reported in community slack. Fixes #267 .

@wagoodman wagoodman added the bug Something isn't working label Oct 28, 2021
@wagoodman wagoodman requested a review from a team October 28, 2021 14:57
@wagoodman wagoodman self-assigned this Oct 28, 2021
@wagoodman wagoodman marked this pull request as ready for review October 29, 2021 14:00
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.

🙌

@@ -0,0 +1,12 @@
require("child_process").spawn("go", [
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting testing approach 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went the "pure go" approach first with no success --I had a few iterations on it before I gave up and went this approach.

Signed-off-by: Alex Goodman <[email protected]>
@wagoodman wagoodman enabled auto-merge (squash) October 29, 2021 14:50
@wagoodman wagoodman merged commit afc9de6 into main Oct 29, 2021
@wagoodman wagoodman deleted the stdin-check branch October 29, 2021 14:52
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

None yet

Development

Successfully merging this pull request may close these issues.

Unable to invoke grype as an external process since 0.8.0

3 participants