Skip to contentSkip to conversation

chardev: Restore CR,LF on stdio

PATCH Applied Philippe Mathieu-Daudé 4 participants 5 messages Jun 7, 2018 – Jun 8, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chardev: Restore CR,LF on stdio

Remove the 'stair-step output' on stdio.

This partially reverts commit 12fb0ac05, which was correct on the mailing list but got corrupted by the maintainer :p

---
See:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06202.html (bug)
http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01309.html (report)

Peter, Can this enters directly as bug-fix?

 chardev/char-stdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-stdio.c +1 -1
index d83e60e787..96375f2ab8 100644
@@ -59,7 +59,7 @@ static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
     if (!echo) {
         tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                          | INLCR | IGNCR | ICRNL | IXON);
-        tty.c_oflag &= ~OPOST;
+        tty.c_oflag |= OPOST;
         tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
         tty.c_cflag &= ~(CSIZE | PARENB);
         tty.c_cflag |= CS8;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Philippe Mathieu-Daudé

Remove the 'stair-step output' on stdio.

This partially reverts commit 12fb0ac05, which was correct on the mailing list but got corrupted by the maintainer :p

---
See:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06202.html (bug)
http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01309.html (report)

Peter, Can this enters directly as bug-fix?

 chardev/char-stdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-stdio.c +0 -0
index d83e60e787..96375f2ab8 100644

chardev/char-stdio.c static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo) · line 65

Quoted 8 lines
chardev/char-stdio.c +1 -1
@@ -59,7 +59,7 @@ static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
     if (!echo) {
         tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                          | INLCR | IGNCR | ICRNL | IXON);
-        tty.c_oflag &= ~OPOST;
+        tty.c_oflag |= OPOST;
         tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
         tty.c_cflag &= ~(CSIZE | PARENB);
         tty.c_cflag |= CS8;

I think this is the right way to go.

#2 lore raw
Quoted 38 lines · Thomas Huth
Quoted 26 lines · Philippe Mathieu-Daudé

Remove the 'stair-step output' on stdio.

This partially reverts commit 12fb0ac05, which was correct on the mailing list but got corrupted by the maintainer :p

---
See:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06202.html (bug)
http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01309.html (report)

Peter, Can this enters directly as bug-fix?

 chardev/char-stdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-stdio.c +0 -0
index d83e60e787..96375f2ab8 100644

chardev/char-stdio.c static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo) · line 65

Quoted 8 lines
chardev/char-stdio.c +1 -1
@@ -59,7 +59,7 @@ static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
     if (!echo) {
         tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                          | INLCR | IGNCR | ICRNL | IXON);
-        tty.c_oflag &= ~OPOST;
+        tty.c_oflag |= OPOST;
         tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
         tty.c_cflag &= ~(CSIZE | PARENB);
         tty.c_cflag |= CS8;

I think this is the right way to go.

Quoted 1 line

Applied to master, thanks.

-- PMM

#3 lore raw

W dniu 08.06.2018 o 17:25, Peter Maydell pisze:

Quoted 38 lines · Thomas Huth
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 26 lines

Remove the 'stair-step output' on stdio.

This partially reverts commit 12fb0ac05, which was correct on the mailing list but got corrupted by the maintainer :p

---
See:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06202.html (bug)
http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01309.html (report)

Peter, Can this enters directly as bug-fix?

 chardev/char-stdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-stdio.c +0 -0
index d83e60e787..96375f2ab8 100644

chardev/char-stdio.c static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo) · line 65

Quoted 8 lines
chardev/char-stdio.c +1 -1
@@ -59,7 +59,7 @@ static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
     if (!echo) {
         tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                          | INLCR | IGNCR | ICRNL | IXON);
-        tty.c_oflag &= ~OPOST;
+        tty.c_oflag |= OPOST;
         tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
         tty.c_cflag &= ~(CSIZE | PARENB);
         tty.c_cflag |= CS8;

I think this is the right way to go.

Quoted 5 lines
Quoted 1 line

Applied to master, thanks.

-- PMM

I actually think it would be better to set c_oflag to (OPOST | ONLCR) to avoid any problems in the future. At this point it is assumed that ONLCR is set.

#4 lore raw
Quoted 39 lines · Patryk Olszewski

W dniu 08.06.2018 o 17:25, Peter Maydell pisze:

Quoted 38 lines · Thomas Huth
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 26 lines

Remove the 'stair-step output' on stdio.

This partially reverts commit 12fb0ac05, which was correct on the mailing list but got corrupted by the maintainer :p

---
See:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06202.html (bug)
http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01309.html (report)

Peter, Can this enters directly as bug-fix?

 chardev/char-stdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char-stdio.c +0 -0
index d83e60e787..96375f2ab8 100644

chardev/char-stdio.c static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo) · line 65

Quoted 8 lines
chardev/char-stdio.c +1 -1
@@ -59,7 +59,7 @@ static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
     if (!echo) {
         tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
                          | INLCR | IGNCR | ICRNL | IXON);
-        tty.c_oflag &= ~OPOST;
+        tty.c_oflag |= OPOST;
         tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
         tty.c_cflag &= ~(CSIZE | PARENB);
         tty.c_cflag |= CS8;

I think this is the right way to go.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Applied to master, thanks.

-- PMM

I actually think it would be better to set c_oflag to (OPOST | ONLCR) to avoid any problems in the future. At this point it is assumed that ONLCR is set.

stdio output worked fine without explicitly setting ONLCR in the past, so unless we hit a situation where it is really required, I'd rather keep it that way now to avoid yet another unexpected regression.

Thomas