SOCK_SEQPACKET UNIX Socket Fallback and Direct Shebang Execution#111
Open
doanbaotrung wants to merge 1 commit into
Open
SOCK_SEQPACKET UNIX Socket Fallback and Direct Shebang Execution#111doanbaotrung wants to merge 1 commit into
doanbaotrung wants to merge 1 commit into
Conversation
66ce56b to
c1e7082
Compare
Collaborator
Author
|
Fix #104 |
There was a problem hiding this comment.
3 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main.c">
<violation number="1" location="src/main.c:565">
P2: Shebang recursion limit is off by one: exactly max depth always fails. Allow max depth and fail only when an additional shebang is encountered.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
| } | ||
|
|
||
| if (shebang_depth >= max_shebang_depth) { |
There was a problem hiding this comment.
P2: Shebang recursion limit is off by one: exactly max depth always fails. Allow max depth and fail only when an additional shebang is encountered.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main.c, line 565:
<comment>Shebang recursion limit is off by one: exactly max depth always fails. Allow max depth and fail only when an additional shebang is encountered.</comment>
<file context>
@@ -440,16 +440,134 @@ int main(int argc, char **argv)
+ }
+ }
+
+ if (shebang_depth >= max_shebang_depth) {
+ log_error("too many levels of shebang recursion (max %d) resolving %s",
+ max_shebang_depth, argv[arg_start]);
</file context>
Updated sys_socket and sys_socketpair to automatically downgrade AF_UNIX sockets of type SOCK_SEQPACKET to SOCK_STREAM on macOS hosts. Initialized the socket options cache using the original LINUX_SOCK_SEQPACKET type, ensuring getsockopt queries for SO_TYPE correctly report SOCK_SEQPACKET to the guest. Direct Shebang Execution Implemented a recursive shebang parsing loop in the standalone loader's entry point. It reads shebang interpreter lines (including optional arguments like #!/bin/sh -x), updates elf_path to point to the interpreter, prepends them to guest_argv, and resolves the host path recursively up to a depth of 5 levels.
99a45a3 to
c8288ed
Compare
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.
Summary by cubic
Adds macOS-safe AF_UNIX SOCK_SEQPACKET by creating SOCK_STREAM sockets on the host while still reporting SOCK_SEQPACKET to the guest. Also adds direct shebang execution with recursive interpreter resolution (max 5) and a daily upstream sync workflow.
SOCK_SEQPACKETfallback on macOS: downgrade toSOCK_STREAMinsys_socketandsys_socketpair, but initialize the socket option cache with the original type sogetsockopt(SO_TYPE)returnsSOCK_SEQPACKET(compatible with the Rosetta shim path).#!, supports one optional arg), prepend interpreter to argv, updateelf_path, resolve recursively up to 5 levels, clean up temp files between steps, and fail cleanly on overflow.Written for commit c8288ed. Summary will update on new commits.