From: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
Patryk Olszewski <patryk@fala.ehost.pl>,
qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] Remove unwanted crlf conversion in serial
Date: Mon, 28 May 2018 17:54:26 +0200 [thread overview]
Message-ID: <2518fb5e-a11e-10c8-7dcf-d53369c17ec6@redhat.com> (raw)
In-Reply-To: <c02439be-e6af-0e10-cb0a-ddb62b48b5de@redhat.com>
On 24/05/2018 07:36, Thomas Huth wrote:
> On 23.05.2018 21:50, Patryk Olszewski wrote:
>> This patch fixes bug in serial that made it almost impossible for guest
>> to communicate with devices through host's serial.
>>
>> OPOST flag in c_oflag enables output processing letting other flags in
>> c_oflag take effect. Usually in c_oflag ONLCR flag is also set, which
>> causes crlf to be sent in place of lf. This breaks binary transmissions.
>> Unsetting OPOST flag turns off any output processing which fixes the bug.
>>
>> Bug reports related:
>> https://bugs.launchpad.net/qemu/+bug/1772086
>> https://bugs.launchpad.net/qemu/+bug/1407813
>> https://bugs.launchpad.net/qemu/+bug/1715296
>> also
>> https://lists.nongnu.org/archive/html/qemu-devel/2006-06/msg00196.html
>>
>> Signed-off-by: Patryk Olszewski <patryk@fala.ehost.pl>
>> ---
>> chardev/char-serial.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/chardev/char-serial.c b/chardev/char-serial.c
>> index feb52e5..ae548d2 100644
>> --- a/chardev/char-serial.c
>> +++ b/chardev/char-serial.c
>> @@ -139,7 +139,7 @@ static void tty_serial_init(int fd, int speed,
>>
>> 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 | ISIG);
>> tty.c_cflag &= ~(CSIZE | PARENB | PARODD | CRTSCTS | CSTOPB);
>> switch (data_bits) {
>>
>
> I think this bug has good chances to win the price "Oldest bug of the
> year". If we'd wait one more months, it has its 15th anniversary: The
> code has originally been added in 2003, see commit 0824d6fc674084519c85,
> it has just been moved around to other files afterwards. Thus this is
> almost as old as QEMU itself!
It was also already fixed once in
commit 64b7b7334b92c1fdc1bb7d3d1afc342656c59539
Author: aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Date: Mon May 5 10:05:31 2008 +0000
Put Pseudo-TTY in rawmode for char devices
(Daniel P. Berrange)
Queued, thanks.
Paolo
next prev parent reply other threads:[~2018-05-28 15:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 19:50 [Qemu-devel] [PATCH v2] Remove unwanted crlf conversion in serial Patryk Olszewski
2018-05-24 5:36 ` Thomas Huth
2018-05-28 15:54 ` Paolo Bonzini [this message]
2018-05-24 6:15 ` Markus Armbruster
2018-05-28 15:56 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2518fb5e-a11e-10c8-7dcf-d53369c17ec6@redhat.com \
--to=pbonzini@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=patryk@fala.ehost.pl \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).