Skip to content

Crash on terminal resize during build #3963

@andni233

Description

@andni233

Using a Dockerfile that creates long lines as part of its build, such as:

FROM alpine

RUN while true; do echo -n .; sleep 0.1; done

During docker build ., if the terminal is resized to a size where the line no longer fits, the build panics:

     panic: runtime error: index out of range [108] with length 92

goroutine 45 [running]:
github.com/docker/cli/vendor/github.com/jaguilar/vt100.(*VT100).put(0xc00068e210, 0xc00000002e)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/github.com/jaguilar/vt100/vt100.go:312 +0xf8
github.com/docker/cli/vendor/github.com/jaguilar/vt100.runeCommand.display(...)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/github.com/jaguilar/vt100/command.go:44
github.com/docker/cli/vendor/github.com/jaguilar/vt100.(*VT100).Process(...)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/github.com/jaguilar/vt100/vt100.go:252
github.com/docker/cli/vendor/github.com/jaguilar/vt100.(*VT100).Write(0xc00068e210, 0xc0008fb698, 0x1, 0x8, 0xc0002d7910, 0xffffffffffffff01, 0xffffffffffffffff)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/github.com/jaguilar/vt100/vt100.go:239 +0x144
github.com/docker/cli/vendor/github.com/moby/buildkit/util/progress/progressui.(*trace).update(0xc00046fea0, 0xc000a1fd10, 0x66)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/github.com/moby/buildkit/util/progress/progressui/display.go:265 +0xa17
github.com/docker/cli/vendor/github.com/moby/buildkit/util/progress/progressui.DisplaySolveStatus(0x560f1bbcd818, 0xc000132028, 0x0, 0x0, 0x560f1bbe3098, 0xc000128408, 0x560f1bb7ff18, 0xc000134010, 0xc0004640c0, 0x0, ...)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/github.com/moby/buildkit/util/progress/progressui/display.go:61 +0x73b
github.com/docker/cli/cli/command/image.doBuild.func2.1(0xc000392160, 0xc0003920d0)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/cli/command/image/build_buildkit.go:286 +0x77
github.com/docker/cli/vendor/golang.org/x/sync/errgroup.(*Group).Go.func1(0xc000676f90, 0xc0002d9da0)
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/golang.org/x/sync/errgroup/errgroup.go:57 +0x5b
created by github.com/docker/cli/vendor/golang.org/x/sync/errgroup.(*Group).Go
        /build/docker.io-JZVJwc/docker.io-20.10.12/.gopath/src/github.com/docker/cli/vendor/golang.org/x/sync/errgroup/errgroup.go:54 +0x68

I was able to reproduce this using:

  • Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1
  • Docker version 24.0.2, build cb74dfc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions