Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Dec 2019 17:49:06 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Vincenzo Maffione <vmaffione@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r355301 - head/usr.sbin/bhyve
Message-ID:  <7783d9967146e4293c27b42f0b65882364e3c1da.camel@freebsd.org>
In-Reply-To: <CA%2B_eA9g2EF2kgNJYfVU5MLZzNXSsep=LYXEVzFGKYWVh-=_ytQ@mail.gmail.com>
References:  <201912022051.xB2Kplot078056@repo.freebsd.org> <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> <CA%2B_eA9g2EF2kgNJYfVU5MLZzNXSsep=LYXEVzFGKYWVh-=_ytQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2019-12-02 at 22:35 +0100, Vincenzo Maffione wrote:
> Il giorno lun 2 dic 2019 alle ore 22:14 Ian Lepore <ian@freebsd.org>
> ha
> scritto:
> 
> > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote:
> > > Author: vmaffione
> > > Date: Mon Dec  2 20:51:46 2019
> > > New Revision: 355301
> > > URL: https://svnweb.freebsd.org/changeset/base/355301
> > > 
> > > Log:
> > >   bhyve: uniform printf format string newlines
> > > 
> > >   Some of the printf statements only use LF to get a newline.
> > > However, a CR character is also required for the serial console
> > > to
> > > print debug logs in a nice way.
> > >   Fix those code locations that only use LF, by adding a CR
> > > character.
> > > 
> > >   Reviewed by:        markj, aleksandr.fedorov@itglobal.com
> > >   MFC after:  1 week
> > >   Differential Revision:      https://reviews.freebsd.org/D22552
> > > 
> > > Modified:
> > >   head/usr.sbin/bhyve/audio.c
> > >   head/usr.sbin/bhyve/hda_codec.c
> > >   head/usr.sbin/bhyve/net_backends.c
> > >   head/usr.sbin/bhyve/pci_ahci.c
> > >   head/usr.sbin/bhyve/pci_e82545.c
> > >   head/usr.sbin/bhyve/pci_hda.c
> > >   head/usr.sbin/bhyve/pci_nvme.c
> > >   head/usr.sbin/bhyve/pci_virtio_block.c
> > >   head/usr.sbin/bhyve/pci_virtio_console.c
> > >   head/usr.sbin/bhyve/pci_virtio_net.c
> > >   head/usr.sbin/bhyve/pci_virtio_rnd.c
> > >   head/usr.sbin/bhyve/pci_virtio_scsi.c
> > >   head/usr.sbin/bhyve/pci_xhci.c
> > >   head/usr.sbin/bhyve/rfb.c
> > > 
> > 
> > These changes seem wrong in a couple ways...
> > 
> >  - Lines are terminated by linefeeds in unix-like systems.  If
> > linefeeds need to be translated to include carriage returns, that's
> > the
> > responsibility of the terminal/line-discipline layer, not the
> > source
> > strings being printed.
> > 
> 
> That's a good point. The need for carriage returns shows up when using the
> vmrun.sh script on a FreeBSD host, which ends up calling /usr/bin/bhyve.
> I must admit I don't know enough about the terminals and ldisc to know how
> to change the current behaviour and fix this specific issue.
> Any suggestions and pointer would be very welcome.
> 
> 
> Thanks,
>   Vincenzo
> 

In that case, I wonder if this is the right fix:

Index: sys/dev/bvm/bvm_console.c
===================================================================
--- sys/dev/bvm/bvm_console.c	(revision 355274)
+++ sys/dev/bvm/bvm_console.c	(working copy)
@@ -223,6 +223,10 @@ static void
 bvm_cnputc(struct consdev *cp, int c)
 {
 
+	if (c == '\n') {
+		bvm_wcons('\r');
+	}
 	bvm_wcons(c);
 }

That's how other console drivers seem to handle it.

-- Ian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7783d9967146e4293c27b42f0b65882364e3c1da.camel>