[urgent] fix(guest): declare terminal=true for TTY execs (libcontainer 0.6 check_terminal) follow-up #611#625
Merged
DorianZheng merged 2 commits intoMay 30, 2026
Conversation
…ck_terminal) libcontainer 0.6 added check_terminal, which rejects a console socket unless the exec's process declares terminal=true and the build is detached. The guest asked youki for a console socket (to receive the PTY master) but left process.terminal=false and detach=false — tolerated by libcontainer 0.5.x, rejected by 0.6 with "invalid runtime spec" (InvalidConsoleSocket). The tenant builder has no per-exec terminal setter, so for TTY execs supply a process.json with terminal=true via ContainerBuilder::with_process and detach=true, so youki allocates the PTY, relays the master fd over the console socket (received by ConsoleSocket), and returns the pid (the zygote reaps it via waitpid). Non-TTY execs are unchanged (pipe fds, no console socket, terminal=false, non-detached). Fixes the TTY exec regression the boxlite-ai#611 libcontainer bump introduced across SDKs: cli test_exec_detach_with_tty_allowed, python test_resize_tty_*, node resizeTty. Verified: 8 TTY tests pass; concurrent_exec (non-TTY) 9/9 unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6bf812b to
72ae368
Compare
…ygote The libcontainer 0.6 check_terminal fix routes TTY execs onto the with_detach(true) + console-socket path. The existing resize_tty tests only kill() then wait(), so none assert that a TTY exec run to *natural* completion has its real exit code reaped by the zygote's waitpid. Add test_tty_exec_collects_natural_exit_code: a TTY exec of `sh -c 'exit 7'` must surface exit_code == 7. Verified against a real box (exit 7 collected); without the build fix on this branch the exec fails to spawn (invalid runtime spec), so this also covers the fix end-to-end on the natural-exit path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
boxlike exec -t requires strict check in libcontainer 0.6.0+ (follow-up #611 )
requires terminal=true
Test plan
Two-sided on
main(libcontainer 0.6): pre-fix =invalid runtime spec, post-fix = pass.test_exec_detach_with_tty_allowedspawn_failed: build failed: invalid runtime spectest_resize_tty_*resizeTty on TTY-enabled runtest_tty_exec_collects_natural_exit_codesh -c 'exit 7'→ exit 7 reaped via zygote)concurrent_exec(regression guard)