Re: [PATCH v2 3/3] iohelper: Don't include newlines in error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2019-02-18 at 11:05 -0500, John Ferlan wrote:
> On 2/13/19 7:04 AM, Andrea Bolognani wrote:
> > The newline was pretty arbitrary, and we're better off
> > without it.
> 
> I'm mostly ambivalent about this one; however, since
> virGetLastErrorMessage could return a string without a "\n", then
> perhaps it's best to keep the \n since it really doesn't hurt.

Without this patch, the user will end up seeing

  $ sudo virsh dump guest /small/guest.dump --memory-only
  error: Failed to core dump domain guest to /small/guest.dump
  error: operation failed: /usr/libexec/libvirt_iohelper: failure with /small/guest.dump
  : Unable to write /small/guest.dump: No space left on device

instead of the more reasonable

  $ sudo virsh dump guest /small/guest.dump --memory-only
  error: Failed to core dump domain guest to /small/guest.dump
  error: operation failed: /usr/libexec/libvirt_iohelper: failure with /small/guest.dump: Unable to write /small/guest.dump: No space left on device

Now, neither is optimal and the way libvirt_iohelper formats its
error messages should be tweaked further, but at least in the latter
case the error is not split randomly with the second line starting
with a colon, which is an improvement in my book.

I was also unable to find other examples of messages passed to
virReportError(), which is what will ultimately happen to this
output, containing newlines. To be fair, I have not really spent a
lot of time looking for them either :)

-- 
Andrea Bolognani / Red Hat / Virtualization


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux