Skip to content

Commit

Permalink
\r does not round-trip the local socket, escape and restore on the ot…
Browse files Browse the repository at this point in the history
…her side (ansible#43507)
  • Loading branch information
Qalthos authored Aug 1, 2018
1 parent c4591f0 commit 9169daa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/ansible-connection
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def main():
raise Exception("EOF found before vars data was complete")
vars_data += cur_line
cur_line = stdin.readline()
# restore escaped loose \r characters
vars_data = vars_data.replace(br'\r', b'\r')

if PY3:
pc_data = cPickle.loads(init_data, encoding='bytes')
Expand Down
2 changes: 2 additions & 0 deletions lib/ansible/executor/task_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,8 @@ def find_file_in_path(filename):
stdin.write(b'\n#END_INIT#\n')

src = cPickle.dumps(variables, protocol=0)
# remaining \r fail to round-trip the socket
src = src.replace(b'\r', br'\r')
stdin.write(src)
stdin.write(b'\n#END_VARS#\n')

Expand Down

0 comments on commit 9169daa

Please sign in to comment.