[Libguestfs] [nbdkit PATCH 0/3] Fix %m usage on BSD

Eric Blake eblake at redhat.com
Thu Nov 29 18:07:37 UTC 2018

On 11/29/18 11:21 AM, Eric Blake wrote:
> Our use of "%m" in various error messages is testament to the
> project's initial life on Linux - but other than Cygwin, I know
> of no other platforms supporting that glibc extension.
> We COULD audit the code and manually turn "%m" into
> "%s"/strerror(errno), but that's a lot of churn. Instead, let's
> fix the few outliers that can't be easily wrapped, then wrap
> the remainder.
> While I was able to test this on Linux (both that no wrapper is
> used by default, and that faking that %m fails causes the wrapper
> to do the right thing), I haven't actually tried it on a BSD box,
> hence I'll wait for review before pushing.

Not fixed here, but still worth doing:

Audit and fix all our uses of nbdkit_error("...\n") to drop their 
trailing newline, as nbdkit_error() adds one.  Then update 
nbdkit_error() to actually do smart newline appending (borrowing from 
commit ef4f72ef) so that other callers outside our codebase get smart 
handling by default.

And on a tangent, I just filed a gcc bug about not flagging %m during 
some form of -Wformat:

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

More information about the Libguestfs mailing list