svn commit: r355301 - head/usr.sbin/bhyve

Ian Lepore ian at freebsd.org
Mon Dec 2 21:14:23 UTC 2019


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 at 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.

 - 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?

-- Ian



More information about the svn-src-head mailing list