Bug 1403326

Summary: docker build sends escape codes to non-terminal FDs
Product: Red Hat Enterprise Linux 7 Reporter: Chris Evich <cevich>
Component: dockerAssignee: Antonio Murdaca <amurdaca>
Status: CLOSED WONTFIX QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: amurdaca, dwalsh, lsm5, santiago
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: docker-autotest:docker_cli/build/onbuild
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-07 10:04:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Chris Evich 2016-12-09 16:32:13 UTC
Description of problem:
Docker is making some assumptions about output device capabilities.  This is a problem because when redirecting or piping the output, it's almost always a royal PITA to parse (human or machine) around the gobbledygook.  It could be a big problem if accessing a system via telnet, serial-link, or some other interface and the output is extraordinarily long.  It's also a problem if the terminal in question doesn't support the particular escape codes being used.

Version-Release number of selected component (if applicable):
docker 1.10
docker 1.12

How reproducible:
Always

Steps to Reproduce:
1. # cat <<EOF | docker build -t foobar - &> /tmp/output
FROM rhel7:latest
RUN /etc/services
EOF

2. # hexdump -c /tmp/output

Actual results:

0000000   S   e   n   d   i   n   g       b   u   i   l   d       c   o
0000010   n   t   e   x   t       t   o       D   o   c   k   e   r    
0000020   d   a   e   m   o   n       2   .   0   4   8       k   B  \r
0000030  \r  \n   S   t   e   p       1       :       F   R   O   M    
0000040   r   h   e   l   7   :   l   a   t   e   s   t  \n       -   -
0000050   -   >       4   a   6   b   6   e   1   a   1   7   d   7  \n
0000060   S   t   e   p       2       :       R   U   N       /   e   t
0000070   c   /   s   e   r   v   i   c   e   s  \n       -   -   -   >
0000080       R   u   n   n   i   n   g       i   n       3   4   e   a
0000090   7   a   9   a   6   c   9   c  \n 033   [   9   1   m   /   b
00000a0   i   n   /   s   h   :       /   e   t   c   /   s   e   r   v
00000b0   i   c   e   s   :       P   e   r   m   i   s   s   i   o   n
00000c0       d   e   n   i   e   d  \n 033   [   0   m   T   h   e    
00000d0   c   o   m   m   a   n   d       '   /   b   i   n   /   s   h
00000e0       -   c       /   e   t   c   /   s   e   r   v   i   c   e
00000f0   s   '       r   e   t   u   r   n   e   d       a       n   o
0000100   n   -   z   e   r   o       c   o   d   e   :       1   2   6
0000110  \n                                                            
0000111


Expected results:

Nothing but printable characters (including space, \t, \n, \r, \x0b, \x0c).

Including w/o setting TERM=dumb

Additional info:
It would be nice if docker actually inspected term. capabilities, but I think at a minimum it should be checking if /proc/self/fd/{0,1,2} are symlinks to PTY's or TTY's.

Comment 3 Daniel Walsh 2017-06-30 16:08:53 UTC
Not sure we should care at this point.

Comment 4 Chris Evich 2017-07-06 13:24:28 UTC
Dan,

I agree, it's easier to just "fix" the Docker Autotest build test.  I'm fine if you want to close as WONTFIX.