From owner-svn-src-head@freebsd.org Tue Dec 3 07:22:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAB191CB324; Tue, 3 Dec 2019 07:22:49 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rtjj2pKnz413k; Tue, 3 Dec 2019 07:22:48 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB37MdOl033596; Mon, 2 Dec 2019 23:22:39 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB37MdrZ033595; Mon, 2 Dec 2019 23:22:39 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve In-Reply-To: <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> To: Ian Lepore Date: Mon, 2 Dec 2019 23:22:39 -0800 (PST) CC: Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47Rtjj2pKnz413k X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-0.99)[-0.994,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:22:49 -0000 > 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. Fully agree, this change seems wrong to me for Ian's stated reason here. > > - The sequence \n\r is very strange. For systems that do prefer > carriage returns, the \r always comes before the \n (or stands alone on > Mac systems), not after. > > I have a feeling that the root of this is something like "lots of > people use bhyve for Windows, so they use Windows apps to look at logs, > so the logs should be formatted for Windows." If that's the reasoning, > then why shouldn't we convert EVERY printf in the source base to > include carriage returns, just in case a windows user wants to browse a > log file? This is not that issue, it is something going on with the line discipline when using the bhyve console device. I believe the line displine being different from what bhyve itself is expecting so when console output is intermixed with output from bhyve itself things go wrong. The printf's in this patch are coming from the bhyve process that has a fd open to the launching tty, the line discipline on that tty is changed to something different after you open the console device from that same controlling tty, or that is my hypothosis on what is going wrong. > -- Ian -- Rod Grimes rgrimes@freebsd.org