Repository navigation
Keep the error code when a process fails to exec - #994
Open
guanchzhou wants to merge 1 commit into
Open
guanchzhou wants to merge 1 commit into
guanchzhou wants to merge 1 commit into
Conversation
When vmexec could not find or exec the target, vminitd wrapped the error-pipe text as internalError, and the host wrapped the gRPC error again, so callers could only tell a missing executable from other failures by matching the message. vmexec now reports a missing executable as notFound and an execvpe failure with EACCES or ENOEXEC as the new notExecutable code. ManagedProcess keeps those two codes from the error pipe, the server maps notExecutable to permissionDenied, and Vminitd.startProcess maps both back, so LinuxProcess.start throws them unchanged. This lets clients report 127 and 126 the way Docker does. Refs apple/container#2210
2 tasks done
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.
Part of apple/container#2210.
When
vmexeccannot find or exec the target, vminitd wraps the error-pipe text asinternalError, and the host wraps the gRPC error again, so a caller can tell a missing executable from other start failures only by matching the message.vmexecreports a missing executable as.notFound, and anexecvpefailure withEACCESorENOEXECas a new.notExecutablecode. Other errno values stayinternalError.ManagedProcess.start()keeps those two codes from the error pipe..notExecutableto gRPCpermissionDenied, andVminitd.startProcessmapsnotFoundandpermissionDeniedback, soLinuxProcess.start()throws them unchanged.With this, apple/container can exit 127 and 126 for these cases, as Docker does.
Tests:
testProcessNoExecutablenow expects.notFound, the newtestProcessNotExecutableruns/etc/passwdand expects.notExecutable, andManagedProcessErrorTestscovers parsing the error-pipe text.make testandmake checkpass on macOS; the Linux unit tests and integration tests were not run locally.