exec: honor ConsoleSize so the terminal is sized at creation#28957
Open
shuaiyuanxx wants to merge 1 commit into
Open
exec: honor ConsoleSize so the terminal is sized at creation#28957shuaiyuanxx wants to merge 1 commit into
shuaiyuanxx wants to merge 1 commit into
Conversation
The exec API accepts a ConsoleSize but it is dropped: the exec pseudo-terminal is created at its default size and only corrected afterwards by an asynchronous resize. A short-lived exec that reads its window size at startup (e.g. `stty size`) can therefore observe the wrong size, because the resize may arrive after the process has already read it. docker applies the size at creation. Carry the requested ConsoleSize through ExecConfig and into the exec OCI process spec (process.consoleSize) so the runtime sizes the terminal before the process starts, removing the race. The local and remote CLIs capture the caller's terminal size when -t is given and pass it through ExecOptions, matching the behavior of `podman run`. Re-enable the previously flaky `podman exec` case in the interactive system test, which this change makes deterministic. Signed-off-by: Shuai Yuan <shuaiyuanzju@gmail.com>
Contributor
|
LGTM |
mheon
approved these changes
Jun 18, 2026
Luap99
reviewed
Jun 18, 2026
Comment on lines
+79
to
+83
| if [[ "$output" =~ stty ]]; then | ||
| echo "# stty flaked, retrying: $output" >&3 | ||
| sleep 1 | ||
| run_podman exec -it mystty stty size <$PODMAN_TEST_PTY | ||
| fi |
Member
There was a problem hiding this comment.
why is there a flake retry here? If you claim this is race free than we should test that it is and never flakes, this will hide a flake
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.
What this does
The exec API accepts a
ConsoleSize, but it is dropped: the exec pseudo-terminal is created at its default size and only corrected afterwards by an asynchronous resize. A short-lived exec that reads its window size at startup (e.g.stty size) cantherefore observe the wrong size, because the resize may arrive after the process has already read it. Docker applies the size at creation.
This change carries the requested
ConsoleSizethroughExecConfigand into the exec OCI process spec (process.consoleSize), so the runtime sizes the terminal before the process starts, removing the race. The local and remote CLIs capture the caller's terminal size when-tis given and pass it throughExecOptions, matching the behavior ofpodman run.How to test
Re-enables the previously flaky podman exec case in test/system/450-interactive.bats, which this change makes deterministic.
Checklist
Does this PR introduce a user-facing change?
exec: the requested console size is now applied when the exec terminal is created, so a process that reads its window size at startup (e.g.
stty size) sees the correct value.