fix(fspy): read the whole shebang line - #788
Open
lifeiscontent wants to merge 2 commits into
Open
lifeiscontent wants to merge 2 commits into
lifeiscontent wants to merge 2 commits into
Conversation
fspy read only the first 128 bytes of a script to find its interpreter, so an interpreter path longer than 126 bytes was cut short. The traced exec then ran the truncated path, which fails or runs a different program, while the same script runs fine without tracing. Read as much as the kernel does instead: 512 bytes on macOS and 256 on Linux. Where the kernel refuses a line that doesn't fit, return ENOEXEC like it does rather than running a truncated path.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
fspy reads only the first 128 bytes of a script to find its interpreter. A script whose interpreter path is longer than 126 bytes runs fine on its own, but under a cached task the path gets cut short. The exec then fails with ENOENT, or runs whatever lives at the shorter path.
Changes