From owner-svn-src-all@freebsd.org Mon Dec 2 21:33:31 2019 Return-Path: Delivered-To: svn-src-all@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 2BBA31B8F5D; Mon, 2 Dec 2019 21:33:31 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rddl0PW4z4Qtx; Mon, 2 Dec 2019 21:33:31 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id DBE04166EC; Mon, 2 Dec 2019 21:33:30 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-qv1-f48.google.com with SMTP id p2so537305qvo.10; Mon, 02 Dec 2019 13:33:30 -0800 (PST) X-Gm-Message-State: APjAAAXJLIMrjepavFF6GZlmEcKdSyl4nzt5jSzPGuBErVnK92KTLprH jodOBjtvnC+rAY+wezppKF+ZmautRZG0UZ/SSY4= X-Google-Smtp-Source: APXvYqygu0IsEtcsjnbzdhlzA3IhCHeCJw1RXhucFO4Qb+cnj9PqfSn82o1fAv4pZd98V9NiN3jPro9XZuLzJ1F7qOY= X-Received: by 2002:a0c:9a43:: with SMTP id q3mr1455100qvd.101.1575322410361; Mon, 02 Dec 2019 13:33:30 -0800 (PST) MIME-Version: 1.0 References: <201912022051.xB2Kplot078056@repo.freebsd.org> <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> In-Reply-To: <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> From: Vincenzo Maffione Date: Mon, 2 Dec 2019 22:35:41 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve To: Ian Lepore Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:33:31 -0000 Il giorno lun 2 dic 2019 alle ore 22:14 Ian Lepore 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. > > - 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. > Also true. I did not realize that, and just reused the same sequence that was used elsewhere. > > 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? > No, as I said above this happens with FreeBSD guests on FreeBSD hosts, using the /share/example/bhyve/vmrun.sh script. Thanks, Vincenzo > > -- Ian > >