summaryrefslogtreecommitdiff
path: root/troubleshooting.md
diff options
context:
space:
mode:
authorErik Sjölund <erik.sjolund@gmail.com>2022-07-03 08:41:24 +0200
committerErik Sjölund <erik.sjolund@gmail.com>2022-07-03 08:55:29 +0200
commit5491123c2cef1bad94aceba39479abdfbd2c63ee (patch)
treeb37dcd18bb050a23cc6f4b246c793047f3bf1fc9 /troubleshooting.md
parentfd33ab09365994ba4625f238c88474a4167ede66 (diff)
downloadpodman-5491123c2cef1bad94aceba39479abdfbd2c63ee.tar.gz
podman-5491123c2cef1bad94aceba39479abdfbd2c63ee.tar.bz2
podman-5491123c2cef1bad94aceba39479abdfbd2c63ee.zip
[CI:DOCS] troubleshooting: document --tty and CR
* Add troubleshooting tip "Unexpected carriage returns are outputted on the terminal" Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
Diffstat (limited to 'troubleshooting.md')
-rw-r--r--troubleshooting.md55
1 files changed, 55 insertions, 0 deletions
diff --git a/troubleshooting.md b/troubleshooting.md
index 05685c906..bfab893a8 100644
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -1231,3 +1231,58 @@ While running podman remote commands with the most updated Podman, issues that w
When upgrading Podman to a particular version for the required fixes, users often make the mistake of only upgrading the Podman client. However, suppose a setup uses `podman-remote` or uses a client that communicates with the Podman server on a remote machine via the REST API. In that case, it is required to upgrade both the Podman client and the Podman server running on the remote machine. Both the Podman client and server must be upgraded to the same version.
Example: If a particular bug was fixed in `v4.1.0` then the Podman client must have version `v4.1.0` as well the Podman server must have version `v4.1.0`.
+
+### 37) Unexpected carriage returns are outputted on the terminal
+
+When using the __--tty__ (__-t__) flag, unexpected carriage returns are outputted on the terminal.
+
+#### Symptom
+
+The container program prints a newline (`\n`) but the terminal outputs a carriage return and a newline (`\r\n`).
+
+```
+$ podman run --rm -t fedora echo abc | od -c
+0000000 a b c \r \n
+0000005
+```
+
+When run directly on the host, the result is as expected.
+
+```
+$ echo abc | od -c
+0000000 a b c \n
+0000004
+```
+
+Extra carriage returns can also shift the prompt to the right.
+
+```
+$ podman run --rm -t fedora sh -c "echo 1; echo 2; echo 3" | cat -A
+1^M$
+ 2^M$
+ 3^M$
+ $
+```
+
+#### Solution
+
+Run Podman without the __--tty__ (__-t__) flag.
+
+```
+$ podman run --rm fedora echo abc | od -c
+0000000 a b c \n
+0000004
+```
+
+The __--tty__ (__-t__) flag should only be used when the program requires user interaction in the termainal, for instance expecting
+the user to type an answer to a question.
+
+Where does the extra carriage return `\r` come from?
+
+The extra `\r` is not outputted by Podman but by the terminal. In fact, a reconfiguration of the terminal can make the extra `\r` go away.
+
+```
+$ podman run --rm -t fedora /bin/sh -c "stty -onlcr && echo abc" | od -c
+0000000 a b c \n
+0000004
+```