qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Sebastian Tanase <sebastian.tanase@openwide.fr>,
	qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	aliguori@amazon.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pty: Fix byte loss bug when connecting to pty
Date: Tue, 02 Sep 2014 09:48:34 -0500	[thread overview]
Message-ID: <20140902144834.16792.75208@loki> (raw)
In-Reply-To: <53D64927.3000604@redhat.com>

Quoting Paolo Bonzini (2014-07-28 07:59:19)
> Il 28/07/2014 13:39, Sebastian Tanase ha scritto:
> > When trying to print data to the pty, we first check if it is connected.
> > If not, we try to reconnect, but we drop the pending data even if we
> > have successfully reconnected; this makes us lose the first byte of the very
> > first transmission.
> > This small fix addresses the issue by checking once more if the pty is connected
> > after having tried to reconnect.
> > 
> > Signed-off-by: Sebastian Tanase <sebastian.tanase@openwide.fr>
> > ---
> > 
> > To reproduce the bug, launch a qemu image that has a parallel port (say lp0)
> > and redirect it to a pty (-parallel pty). After the VM is launched,
> > open the corresponding pty on your host (cat /dev/pts/X) and send some
> > data from the VM to the host: echo "abcd" > /dev/lp0
> > The first time, the received string will be "bcd" instead of "abcd".
> > This bug can have important consequences if you try, for example,
> > to send a postscript file from a printer within the VM. Losing the
> > first character will render the .ps file unusable.
> > ---
> >  qemu-char.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/qemu-char.c b/qemu-char.c
> > index 7acc03f..ce52d0f 100644
> > --- a/qemu-char.c
> > +++ b/qemu-char.c
> > @@ -1160,7 +1160,9 @@ static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
> >      if (!s->connected) {
> >          /* guest sends data, check for (re-)connect */
> >          pty_chr_update_read_handler_locked(chr);
> > -        return 0;
> > +        if (!s->connected) {
> > +            return 0;
> > +        }
> >      }
> >      return io_channel_send(s->fd, buf, len);
> >  }
> > 
> 
> Looks ok, though only for 2.2 and 2.1.1.  Gerd, can you take care of
> this patch?

Ping for qemu-stable 2.1.1, freeze is tomorrow.

> 
> Paolo

      reply	other threads:[~2014-09-02 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 11:39 [Qemu-devel] [PATCH] pty: Fix byte loss bug when connecting to pty Sebastian Tanase
2014-07-28 12:59 ` Paolo Bonzini
2014-09-02 14:48   ` Michael Roth [this message]

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=20140902144834.16792.75208@loki \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=aliguori@amazon.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=sebastian.tanase@openwide.fr \
    /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).