Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken output with disabled pseudo-tty allocation #9086

Closed
nawa opened this issue Jan 6, 2022 · 1 comment · Fixed by #9113
Closed

Broken output with disabled pseudo-tty allocation #9086

nawa opened this issue Jan 6, 2022 · 1 comment · Fixed by #9113

Comments

@nawa
Copy link

nawa commented Jan 6, 2022

Broken output with disabled pseudo-tty allocation docker-compose exec -T

Steps to reproduce the issue:

  1. Docker compose config

    version: '3.5'
    
    services:
      wget:
        image: cirrusci/wget
        command: tail -f /dev/null
  2. Run commands

    $ docker-compose up -d
    $ docker-compose exec -T wget wget http://ipv4.download.thinkbroadband.com/1MB.zip

Describe the results you received:

Corrupted output:

--2022-01-05 09:35:54--  http://ipv4.download.thinkbroadband.com/1MB.zip
                                                                        Resolving ipv4.download.thinkbroadband.com... 80.249.99.148
                                                                                                                                   Connecting to ipv4.download.thinkbroadband.com|80.249.99.148|:80... connected.
                                                                                                                                                                                                                 HTTP request sent, awaiting response... 200 OK
                                                                                                                                                                                                                                                               Length: 1048576 (1.0M) [application/zip]
            Saving to: '1MB.zip'

                                     0K .......... .......... .......... .......... ..........  4%  424K 2s
                                                                                                               50K .......... .......... .......... .......... ..........  9%  811K 2s
                                                                                                                                                                                         100K .......... .......... .......... .......... .......... 14% 7.46M 1s
                                                                                                                                                                                                                                                                    150K .......... .......... .......... .......... .......... 19%  989K 1s
                                                    200K .......... .......... .......... .......... .......... 24% 6.92M 1s
                                                                                                                               250K .......... .......... .......... .......... .......... 29% 15.3M 1s
                                                                                                                                                                                                          300K .......... .......... .......... .......... .......... 34%  776K 1s
                                                                                                                                                                                                                                                                                     350K .......... .......... .......... .......... .......... 39% 7.50M 0s
                                                                     400K .......... .......... .......... .......... .......... 43% 1.49M 0s
                                                                                                                                                450K .......... .......... .......... .......... .......... 48% 2.10M 0s
                                                                                                                                                                                                                           500K .......... .......... .......... .......... .......... 53% 7.49M 0s
           550K .......... .......... .......... .......... .......... 58% 1.49M 0s
                                                                                      600K .......... .......... .......... .......... .......... 63% 2.01M 0s
                                                                                                                                                                 650K .......... .......... .......... .......... .......... 68% 3.76M 0s
                                                                                                                                                                                                                                            700K .......... .......... .......... .......... .......... 73% 2.24M 0s
                            750K .......... .......... .......... .......... .......... 78% 2.00M 0s
                                                                                                       800K .......... .......... .......... .......... .......... 83% 3.48M 0s
                                                                                                                                                                                  850K .......... .......... .......... .......... .......... 87% 3.02M 0s
                                                                                                                                                                                                                                                             900K .......... .......... .......... .......... .......... 92% 2.05M 0s
                                             950K .......... .......... .......... .......... .......... 97% 2.39M 0s
                                                                                                                       1000K .......... .......... ....                            100% 3.37M=0.6s

                                                                                                                                                                                                  2022-01-05 09:35:54 (1.73 MB/s) - '1MB.zip' saved [1048576/1048576]

Describe the results you expected:

I expect correctly formatted output the same that docker exec without tty produces

$ docker exec tty-wget-1 wget http://ipv4.download.thinkbroadband.com/1MB.zip                                                                                                                                                          

--2022-01-05 09:42:21--  http://ipv4.download.thinkbroadband.com/1MB.zip
Resolving ipv4.download.thinkbroadband.com... 80.249.99.148
Connecting to ipv4.download.thinkbroadband.com|80.249.99.148|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1048576 (1.0M) [application/zip]
Saving to: '1MB.zip.1'

     0K .......... .......... .......... .......... ..........  4%  417K 2s
    50K .......... .......... .......... .......... ..........  9%  838K 2s
   100K .......... .......... .......... .......... .......... 14% 50.2M 1s
   150K .......... .......... .......... .......... .......... 19%  842K 1s
   200K .......... .......... .......... .......... .......... 24% 3.94M 1s
   250K .......... .......... .......... .......... .......... 29% 6.73M 1s
   300K .......... .......... .......... .......... .......... 34% 1.15M 1s
   350K .......... .......... .......... .......... .......... 39% 11.1M 0s
   400K .......... .......... .......... .......... .......... 43% 1.02M 0s
   450K .......... .......... .......... .......... .......... 48% 3.04M 0s
   500K .......... .......... .......... .......... .......... 53% 18.1M 0s
   550K .......... .......... .......... .......... .......... 58% 1.16M 0s
   600K .......... .......... .......... .......... .......... 63% 6.67M 0s
   650K .......... .......... .......... .......... .......... 68% 6.82M 0s
   700K .......... .......... .......... .......... .......... 73% 1.05M 0s
   750K .......... .......... .......... .......... .......... 78% 8.07M 0s
   800K .......... .......... .......... .......... .......... 83% 6.01M 0s
   850K .......... .......... .......... .......... .......... 87% 1.04M 0s
   900K .......... .......... .......... .......... .......... 92% 13.0M 0s
   950K .......... .......... .......... .......... .......... 97% 9.09M 0s
  1000K .......... .......... ....                            100%  597K=0.6s

2022-01-05 09:42:22 (1.70 MB/s) - '1MB.zip.1' saved [1048576/1048576]

OS: macOS 11.6.2

Docker-compose version:

  • v2.2.1 installed with docker for Mac 4.3.2
  • v2.2.2 installed with brew

It is the same bug as already closed #8833. The fix was released in v2.2.0 but still reproduced in v2.2.1 and v2.2.2

@x-yuri
Copy link
Contributor

x-yuri commented Jan 18, 2022

Apparently, because #8938 fixes only the run command:

in := streams.NewIn(opts.Stdin)
if in.IsTerminal() && opts.Tty {
state, err := term.SetRawTerminal(in.FD())
if err != nil {
return 0, err
}
defer term.RestoreTerminal(in.FD(), state) //nolint:errcheck
}

in := streams.NewIn(opts.Stdin)
if in.IsTerminal() {
state, err := term.SetRawTerminal(in.FD())
if err != nil {
return err
}
defer term.RestoreTerminal(in.FD(), state) //nolint:errcheck
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants