Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Docker CLI improperly parses, mangles then mis-represents commands in table
Version-Release number of selected component (if applicable):
0.9.1
How reproducible:
Easy
Steps to Reproduce:
1. # docker run fedora bash -c "echo 'this is a really really really really super big really really really really long command' > /tmp/foobar"
2. # docker ps --all --no-trunc
3. # docker run fedora bash -c "echo -e 'line one\nline\ttwo\n\n\t\t\tline three'"
4. # docker ps --all --no-trunc
5. # FOO=`echo -e 'line one\nline\ttwo\n\n\t\t\tline three'` docker run fedora bash -c "echo \'${FOO}\'"
6. # docker ps --all --no-trunc
Actual results:
[root@docker ~]#
[root@docker ~]# docker run fedora bash -c "echo 'this is a really really really really super big really really really really long command'"
this is a really really really really super big really really really really long command
[root@docker ~]# docker ps --all --no-trunc
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3352ec67936554d4dbddd747b1d13f6cf1743cc90533caf152711d3214a04e7b fedora:20 bash -c 'echo 'this is a really really really really super big really really really really long command'' 8 seconds ago Exited (0) 5 seconds ago angry_torvalds
[root@docker ~]# docker run fedora bash -c "echo -e 'line one\nline\ttwo\n\n\t\t\tline three'"
line one
line two
line three
[root@docker ~]# docker ps --all --no-trunc
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9197d0cec4eb92af38618289216a4c7fb3d055904fea78352b640c523c88363d fedora:20 bash -c 'echo -e 'line one
line two
line three'' 17 seconds ago Exited (0) 15 seconds ago drunk_heisenberg
3352ec67936554d4dbddd747b1d13f6cf1743cc90533caf152711d3214a04e7b fedora:20 bash -c 'echo 'this is a really really really really super big really really really really long command'' About a minute ago Exited (0) 57 seconds ago angry_torvalds
[root@docker ~]# # FOO=`echo -e 'line one\nline\ttwo\n\n\t\t\tline three'` docker run fedora bash -c "echo \'${FOO}\'"
[root@docker ~]# FOO=`echo -e 'line one\nline\ttwo\n\n\t\t\tline three'` docker run fedora bash -c "echo \'${FOO}\'"
'line one
bash: line 1: line: command not found
bash: line 3: line: command not found
[root@docker ~]# docker ps --all --no-trunc
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c0449d286d61e252707f6a1afbc329b9b9cd92cb1daf77c85154904b119b6e87 fedora:20 "bash -c 'echo \'line one
line two
line three\''" 15 seconds ago Exited (127) 13 seconds ago clever_tesla
9197d0cec4eb92af38618289216a4c7fb3d055904fea78352b640c523c88363d fedora:20 bash -c 'echo -e 'line one
line two
line three'' About a minute ago Exited (0) About a minute ago drunk_heisenberg
3352ec67936554d4dbddd747b1d13f6cf1743cc90533caf152711d3214a04e7b fedora:20 bash -c 'echo 'this is a really really really really super big really really really really long command'' About a minute ago Exited (0) About a minute ago angry_torvalds
[root@docker ~]#
Expected results:
2. Column widths are set properly for this command, however quotes have been altered, i.e. " was replaced by '
4a. "COMMAND" Column width shrunk to 20-characters, no longer matches width for data from either container.
4b. In table data for #3 container, "COMMAND" column shows docker is parsing command and translating escape codes instead of passing them through literally (i.e. "\n" and "\t" are just strings, not literal newlines and tabs.
6a. "COMMAND" Column width shrunk to 20-characters, no longer matches width for data from any container.
6b. Similar to #4b, except literal newlines are NOT escaped, and output in newline-separated table-format. i.e. row-delimiter for table not escaped in row data.
Additional info:
Setting to medium largely b/c #3, docker should not be interpreting any commands argument data, it should be passed through literally, as written. Another example:
[root@docker ~]# docker run fedora bash -c "echo -e 'hidden data\b\b\b\b\b\b\b\b\b\b\b'"
hidden data
[root@docker ~]# docker ps --all --no-trunc
CONTAINER ID...
584e56f846c4be84bb3ac15cf5d25a821da593a7a0127959d3f3b38764febc4e fedora:20 bash -c 'echo -e ''' ...
Docker upstream seems to have fixed the alignment issues (column width and related issues), but newlines and other nonprintable and control characters are still not escaped. I'm working on a patch now.
Pull request open with upstream: https://github.com/dotcloud/docker/pull/6573
It's unlikely this will make it into RHEL7's docker-1.0 build, but the subsequent release should include a fix.
Patch is now in RHEL7 docker-1.0 builds. This should definitely be a fix for the nonprintable/control characters issue.
I haven't been able to reproduce the column widths issue, so I'm assuming it was fixed upstream for 1.0. This should be tested further, though.
Great. Yeah the column-width issue is a PITA to verify, I wound up literally counting columns by hand. Though we have a test now that's very sensitive to header vs data column widths. It should altert us of any problems, given whitespace-filled docker commands. Thanks for the update.
All issues confirmed fixed in
docker-1.0.0-10.el7.x86_64
Client version: 1.0.0
Client API version: 1.12
Go version (client): go1.2.2
Git commit (client): 20fdb42/1.0.0
Server version: 1.0.0
Server API version: 1.12
Go version (server): go1.2.2
Git commit (server): 20fdb42/1.0.0
I ran the above steps to re-create, piped the output into ``hexdump -C | less`` and subtracted the end/startoffsets. The COMMAND column header showed max of ~123 characters (including padding to next column). All commands had all special characters properly escaped, and entire line was also quoted (nice touch). Verified in all cases, the COMMAND column data was always padded out to the same ~123 characters (including pading to next column). I also verified there were no unexpected (hidden) characters in the output, just regular ascii characters and newlines (linefeeds). Yay!
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHBA-2014-1266.html
Description of problem: Docker CLI improperly parses, mangles then mis-represents commands in table Version-Release number of selected component (if applicable): 0.9.1 How reproducible: Easy Steps to Reproduce: 1. # docker run fedora bash -c "echo 'this is a really really really really super big really really really really long command' > /tmp/foobar" 2. # docker ps --all --no-trunc 3. # docker run fedora bash -c "echo -e 'line one\nline\ttwo\n\n\t\t\tline three'" 4. # docker ps --all --no-trunc 5. # FOO=`echo -e 'line one\nline\ttwo\n\n\t\t\tline three'` docker run fedora bash -c "echo \'${FOO}\'" 6. # docker ps --all --no-trunc Actual results: [root@docker ~]# [root@docker ~]# docker run fedora bash -c "echo 'this is a really really really really super big really really really really long command'" this is a really really really really super big really really really really long command [root@docker ~]# docker ps --all --no-trunc CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3352ec67936554d4dbddd747b1d13f6cf1743cc90533caf152711d3214a04e7b fedora:20 bash -c 'echo 'this is a really really really really super big really really really really long command'' 8 seconds ago Exited (0) 5 seconds ago angry_torvalds [root@docker ~]# docker run fedora bash -c "echo -e 'line one\nline\ttwo\n\n\t\t\tline three'" line one line two line three [root@docker ~]# docker ps --all --no-trunc CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9197d0cec4eb92af38618289216a4c7fb3d055904fea78352b640c523c88363d fedora:20 bash -c 'echo -e 'line one line two line three'' 17 seconds ago Exited (0) 15 seconds ago drunk_heisenberg 3352ec67936554d4dbddd747b1d13f6cf1743cc90533caf152711d3214a04e7b fedora:20 bash -c 'echo 'this is a really really really really super big really really really really long command'' About a minute ago Exited (0) 57 seconds ago angry_torvalds [root@docker ~]# # FOO=`echo -e 'line one\nline\ttwo\n\n\t\t\tline three'` docker run fedora bash -c "echo \'${FOO}\'" [root@docker ~]# FOO=`echo -e 'line one\nline\ttwo\n\n\t\t\tline three'` docker run fedora bash -c "echo \'${FOO}\'" 'line one bash: line 1: line: command not found bash: line 3: line: command not found [root@docker ~]# docker ps --all --no-trunc CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c0449d286d61e252707f6a1afbc329b9b9cd92cb1daf77c85154904b119b6e87 fedora:20 "bash -c 'echo \'line one line two line three\''" 15 seconds ago Exited (127) 13 seconds ago clever_tesla 9197d0cec4eb92af38618289216a4c7fb3d055904fea78352b640c523c88363d fedora:20 bash -c 'echo -e 'line one line two line three'' About a minute ago Exited (0) About a minute ago drunk_heisenberg 3352ec67936554d4dbddd747b1d13f6cf1743cc90533caf152711d3214a04e7b fedora:20 bash -c 'echo 'this is a really really really really super big really really really really long command'' About a minute ago Exited (0) About a minute ago angry_torvalds [root@docker ~]# Expected results: 2. Column widths are set properly for this command, however quotes have been altered, i.e. " was replaced by ' 4a. "COMMAND" Column width shrunk to 20-characters, no longer matches width for data from either container. 4b. In table data for #3 container, "COMMAND" column shows docker is parsing command and translating escape codes instead of passing them through literally (i.e. "\n" and "\t" are just strings, not literal newlines and tabs. 6a. "COMMAND" Column width shrunk to 20-characters, no longer matches width for data from any container. 6b. Similar to #4b, except literal newlines are NOT escaped, and output in newline-separated table-format. i.e. row-delimiter for table not escaped in row data. Additional info: Setting to medium largely b/c #3, docker should not be interpreting any commands argument data, it should be passed through literally, as written. Another example: [root@docker ~]# docker run fedora bash -c "echo -e 'hidden data\b\b\b\b\b\b\b\b\b\b\b'" hidden data [root@docker ~]# docker ps --all --no-trunc CONTAINER ID... 584e56f846c4be84bb3ac15cf5d25a821da593a7a0127959d3f3b38764febc4e fedora:20 bash -c 'echo -e ''' ...