镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Keep the error code when a process fails to exec - #994

Open
guanchzhou wants to merge 1 commit into
apple:mainfrom
guanchzhou:fix/exec-failure-error-codes
Open

guanchzhou wants to merge 1 commit into
apple:mainfrom
guanchzhou:fix/exec-failure-error-codes

Conversation

@guanchzhou

@guanchzhou guanchzhou commented Oct 26, 2026 •

Copy link
Copy Markdown

Part of apple/container#2210.

When vmexec cannot find or exec the target, vminitd wraps the error-pipe text as internalError, 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.

  • vmexec reports a missing executable as .notFound, and an execvpe failure with EACCES or ENOEXEC as a new .notExecutable code. Other errno values stay internalError.
  • ManagedProcess.start() keeps those two codes from the error pipe.
  • The server maps .notExecutable to gRPC permissionDenied, and Vminitd.startProcess maps notFound and permissionDenied back, so LinuxProcess.start() throws them unchanged.

With this, apple/container can exit 127 and 126 for these cases, as Docker does.

Tests: testProcessNoExecutable now expects .notFound, the new testProcessNotExecutable runs /etc/passwd and expects .notExecutable, and ManagedProcessErrorTests covers parsing the error-pipe text. make test and make check pass on macOS; the Linux unit tests and integration tests were not run locally.

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

This branch has not been deployed

No deployments
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.

1 participant