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

Only read the first line for shbang. #1213

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

smoser
Copy link
Contributor

@smoser smoser commented May 16, 2024

I noticed this when I was playing with a shbang program like:

 #!/usr/bin/env busybox sh
 echo hello world

Melange would give a warning like this:

 Error reading shbang from usr/bin/hello-busybox:
    a shbang of only '/usr/bin/env' with multiple arguments
       (6 /usr/bin/env busybox sh echo "hello world")

@smoser smoser force-pushed the fix/only-one-line-in-shbang branch 2 times, most recently from eed1e30 to ad04838 Compare May 16, 2024 14:16
@imjasonh
Copy link
Member

Is there a test you could add to demonstrate the problem, and that this is the fix?

Do you have an idea if there are packages in the wild that will produce different provideses with this change? Or is this just about avoiding the misleading warning?

@smoser
Copy link
Contributor Author

smoser commented May 16, 2024

Is there a test you could add to demonstrate the problem, and that this is the fix?

Do you have an idea if there are packages in the wild that will produce different provideses with this change? Or is this just about avoiding the misleading warning?

i could add a test.l I'm pretty sure this only affects the error path, in which there will be no provides generated.

@smoser
Copy link
Contributor Author

smoser commented Sep 17, 2024

@imjasonh got around to adding a test, and i think fixed another bug. we'll see if it passes the other tests I didn't write (or run) just now.

@smoser smoser force-pushed the fix/only-one-line-in-shbang branch 2 times, most recently from 6dc7b5e to 25e1a05 Compare September 18, 2024 01:19
I noticed this when I was playing with a shbang program like:

   #!/usr/bin/env busybox sh
   echo hello world

Melange would give a warning like this:

   Error reading shbang from usr/bin/hello-busybox:
      a shbang of only '/usr/bin/env' with multiple arguments
         (6 /usr/bin/env busybox sh echo "hello world")

The new message would be:

   Error reading shbang from usr/bin/hello-busybox:
      a shbang of only '/usr/bin/env' with multiple arguments
         (3 /usr/bin/env busybox sh)

Signed-off-by: Scott Moser <[email protected]>
@smoser smoser merged commit d2bf9f2 into chainguard-dev:main Sep 18, 2024
35 checks passed
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.

2 participants