diff --git a/bin/ansible-connection b/bin/ansible-connection index 9b1ae2cd04..322ccc5a91 100755 --- a/bin/ansible-connection +++ b/bin/ansible-connection @@ -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') diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 53bddc555f..b91e480742 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -936,6 +936,8 @@ class TaskExecutor: 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')