Skip to content

Conversation

@ParkSeongGeun
Copy link
Contributor

@ParkSeongGeun ParkSeongGeun commented Jan 10, 2026

Summary

Fixes the root cause for apple/container#962.

This PR fixes an issue where relative paths provided as an entrypoint or command (e.g., ./uname) failed to execute. The root cause was that executable paths were being validated before the working directory was changed (chdir) in the guest VM executor, leading to a "failed to find target executable" error.

Motivation and Context

In the current vmexec implementation, the file existence check occurs before applying the OCI workingDirectory. Following the "cleaner approach" suggested by maintainers in apple/container#987, this change ensures that the executor itself handles relative path resolution internally.

Key Changes:

  • Relative Path Detection: The executor now detects paths containing / or starting with .
  • CWD-based Resolution: It resolves these relative paths against the OCI-specified workingDirectory before performing the binary existence check.
  • Path Normalization: Utilizes URL.standardized.path to ensure a clean absolute path is passed to the execution system.
  • Bare Command Preservation: Explicitly preserves bare command resolution (e.g., ls, uname) via the system PATH by checking for the absence of slashes.

This aligns the executor's behavior with industry standards seen in Docker and Podman.

Testing & Verification

Integration Tests

  • Primary Scenario: Executed container run --workdir /bin --entrypoint ./uname alpine.
  • Result: Successfully resolved to /bin/uname inside the VM and returned Linux.
  • Regression: Confirmed that absolute paths (/bin/ls) and bare commands (ls) continue to function correctly via system PATH.

Cross-Repository Coordination

  • CLI Compatibility: Verified that this fix works seamlessly with the container CLI.
  • Unit Test Coordination: This change is coordinated with the newly added testProcessEntrypointRelativePathPassthrough in the apple/container repository (ParserTest.swift).
  • Proof of Flow: Confirmed that when the CLI passes a relative path untouched, this updated vmexec correctly handles the resolution internally, keeping the OCI bundle configuration clean and logic centralized in the executor.

Copy link
Contributor

@jglogan jglogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, see the comment, just a nit.

…exec

Signed-off-by: ParkSeongGeun <phd0801@naver.com>
@ParkSeongGeun ParkSeongGeun force-pushed the fix/vmexec-relative-path branch from b44f6a0 to a0c755f Compare January 11, 2026 23:42
@ParkSeongGeun ParkSeongGeun requested a review from jglogan January 12, 2026 00:04
@jglogan
Copy link
Contributor

jglogan commented Jan 12, 2026

@ParkSeongGeun Thanks! I see you've already updated the container PR so that we're still testing it there, was going to ask you to do that 😄

@jglogan jglogan merged commit cbc03d7 into apple:main Jan 12, 2026
2 checks passed
jglogan pushed a commit to apple/container that referenced this pull request Jan 12, 2026
- Fixes #962.
- Adds test to exercise apple/containerization#473.
- Updates containerization to 0.20.1.

Signed-off-by: ParkSeongGeun <phd0801@naver.com>
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