[Libguestfs] [nbdkit PATCH 0/3] Fix %m usage on BSD
Richard W.M. Jones
rjones at redhat.com
Thu Nov 29 17:34:33 UTC 2018
On Thu, Nov 29, 2018 at 11:21:27AM -0600, 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.
I tested these on FreeBSD 11.2:
checking whether the printf family supports %m... no
$ ./nbdkit file /dev/pci -f -v
(where /dev/pci is unreadable by non-root). When accessing this
device I see errors like:
nbdkit: debug: accepted connection
nbdkit: debug: file: open readonly=0
nbdkit: error: open: /dev/pci: Permission denied
which I believe are evidence that the %m formatter is being expanded
correctly in plugins/file/file.c.
Also without your patches I see:
nbdkit: error: open: /dev/pci: m
I checked the patches themselves and they look fine too so:
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
More information about the Libguestfs