Bug 1668763 - oc rsh modifies output by inserting CRLF
Summary: oc rsh modifies output by inserting CRLF
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.10.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.1.0
Assignee: Juan Vallejo
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-23 14:31 UTC by Brendan Mchugh
Modified: 2019-10-23 08:30 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-24 18:07:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Brendan Mchugh 2019-01-23 14:31:43 UTC
Description of problem:
When piping output from "oc rsh", CRLF characters are inserted changing the original output.
"oc exec" does not modify the output.

Version-Release number of selected component (if applicable):
oc v3.10.89
openshift v3.10.89
kubernetes v1.10.0+b81c8f8


How reproducible:
Always

Steps to Reproduce:
1. oc project <some_project>
2. oc exec <podname> cat somefile > outfile.exec
3. oc rsh <podname> cat somefile  > outfile.rsh

Actual results:
[root@test ~]# oc project default
Already on project "default" on server "https://test.example.com:8443".

[root@test ~]# oc exec router-1-4w5w5 cat haproxy-config.template > haproxy-config.template.exec
[root@test ~]# oc rsh router-1-4w5w5 cat haproxy-config.template > haproxy-config.template.rsh

[root@test ~]# ls -la haproxy-config.template.*
-rw-r--r--. 1 root root 28002 Jan 23 14:30 haproxy-config.template.exec
-rw-r--r--. 1 root root 28558 Jan 23 14:30 haproxy-config.template.rsh


[root@test ~]# file haproxy-config.template.exec
haproxy-config.template.exec: ASCII text, with very long lines

[root@test ~]# file haproxy-config.template.rsh
haproxy-config.template.rsh: ASCII text, with very long lines, with CRLF line terminators


md5sum within running container.
sh-4.2$ md5sum haproxy-config.template 
6fb15bc4f46c731054f05fa988579d2e  haproxy-config.template

md5sum of output files.
[root@test ~]# md5sum haproxy-config.template.*
6fb15bc4f46c731054f05fa988579d2e  haproxy-config.template.exec
491b27fbeb8ef13b5e5027fcea1a7af4  haproxy-config.template.rsh


Expected results:
Output should not be modified.

Additional info:

Comment 1 Juan Vallejo 2019-01-23 16:45:39 UTC
`oc rsh` attaches a tty by default. Do you still see extra chars inserted in your output after running `oc rsh --no-tty=true ...` ?

This could be a possible duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1638447

Comment 2 Brendan Mchugh 2019-01-24 07:54:37 UTC
Thank you for the clarification.

With 'oc rsh --no-tty=true' the output matches that of the file inside the container.


I will file a separate docs bug against the "bare" oc rsh usage we advise for copying the haproxy configuartion files in the customizing haproxy section of the docs as that is where this issue has come up and in the linked bz 1638447. [1]
We should probably be recommending either 'oc exec' or 'oc cp' usage rather than 'oc rsh'.

[1] https://docs.openshift.com/container-platform/3.10/install_config/router/customized_haproxy_router.html#obtaining-router-configuration-template

Comment 3 Juan Vallejo 2019-01-24 18:07:04 UTC
> We should probably be recommending either 'oc exec' or 'oc cp' usage rather than 'oc rsh'.

Yes, I definitely agree.

Thanks for confirming `oc rsh --no-tty` matches the desired output. Closing this as NOTABUG.


Note You need to log in before you can comment on or make changes to this bug.