docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit
Apache License 2.0
3.58k stars 482 forks source link

TTY gets in a bad state when starting a debug build #2808

Open andyneff opened 12 hours ago

andyneff commented 12 hours ago

Contributing guidelines

I've found a bug and checked that ...

Description

When using the experimental debug build, tty gets all messed up, when it was working before. I suspect one of the many tty state flags is getting messed up, but I don't have a clue which.

Expected behaviour

TTY not be return the the beginning of the line after every single character typed once a debug has been invoked. The correct behavior can be see with the workaround:

BUILDX_EXPERIMENTAL=1 docker buildx debug --invoke /bin/sh build --progress=plain .

It looks like turning off the tty for the progress prevents whatever bad state the terminal is getting in.

Actual behaviour

TTY returns the the beginning of the line after every single character typed once a debug has been invoked.

I've tested this in Original Command Prompt, Window Terminal, xterm, git's mintty terminal (on window), and they all have this erroneous behavior now

Buildx version

github.com/docker/buildx v0.17.1 257815a

Docker info

Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 146
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: nvidia runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 57f17b0a6295a39009d861b89e3b3b87b005ca27
 runc version: v1.1.14-0-g2c9f560
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.3-100.fc39.x86_64
 Operating System: Fedora Linux 39 (Workstation Edition)
 OSType: linux
 Architecture: x86_64
 CPUs: 192
 Total Memory: 503.1GiB
 Name: ***
 ID: ***
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Builders list

NAME/NODE              DRIVER/ENDPOINT                   STATUS     BUILDKIT   PLATFORMS
default*               docker
 \_ default             \_ default                       running    v0.16.0    linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/loong64, linux/arm/v7, linux/arm/v6

Configuration

FROM alpine
RUN echo hi; false
BUILDX_EXPERIMENTAL=1 docker buildx debug --invoke /bin/sh build .

Build logs

Additional info

Was working in buildx 0.14.0, but when I upgraded, it stopped working correctly since at least 0.16.2. I've also tested it locally on a windows laptop with WSL2. And the problem happens there too. So it was working, and then it wasn't.