mirror of
https://github.com/games-on-whales/LXC2Docker.git
synced 2026-10-15 21:02:07 +00:00
[PR #101] [MERGED] fix(attach): stdcopy-frame replayed logs on non-TTY attach #100
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/LXC2Docker#100
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/LXC2Docker/pull/101
Author: @JBailes
Created: 7/1/2026
Status: ✅ Merged
Merged: 7/1/2026
Merged by: @JBailes
Base:
main← Head:fix/attach-logs-stdcopy-framing📝 Commits (1)
f4d5d5dfix(attach): stdcopy-frame replayed logs on non-TTY attach📊 Changes
2 files changed (+153 additions, -16 deletions)
View changed files
➕
internal/api/attach_framing_test.go(+94 -0)📝
internal/api/containers.go(+59 -16)📄 Description
Problem
POST /containers/{id}/attach?logs=1&stream=1(thedocker runforeground anddocker attachpath) replayed the container's historical console log with a rawio.Copy(conn, f), but the live stream that follows frames non-TTY output with Docker's 8-byte stdcopy header (stream id + big-endian length).A stdcopy-demuxing client — the
dockerCLI or any SDKContainerAttach+stdcopy.StdCopyagainst a non-TTY container — reads the first 8 bytes of replayed log content as a frame header, gets a garbage length, and desyncs. The rest of the attach stream is corrupted.Docker behavior
Docker frames the replayed logs identically to the live stream: raw for TTY containers, stdcopy-framed for non-TTY. There is no unframed/framed boundary.
Fix
Ttyflag governs framing for both the replay and the live loop.writeFramedStreamhelper and the live loop throughwriteStreamFrame, so both sides frame identically.stream/logsflag handling.Tests
internal/api/attach_framing_test.go:make test-build,make test-unit,go vet,go build ./...all green locally.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.