Eric Blake
2017-Jan-31 21:00 UTC
[Libguestfs] [nbdkit PATCH 0/2] fix pod and other errors in recent patches
POD errors are not nice, and 'pod2man --stderr' does not do what we want. Eric Blake (2): perl: Fix previous patches build: Kill build on POD error .gitignore | 2 ++ configure.ac | 10 +--------- docs/Makefile.am | 8 ++++++-- docs/nbdkit-plugin.pod | 2 +- plugins/curl/Makefile.am | 4 +++- plugins/example1/Makefile.am | 4 +++- plugins/example2/Makefile.am | 4 +++- plugins/example3/Makefile.am | 4 +++- plugins/file/Makefile.am | 4 +++- plugins/guestfs/Makefile.am | 4 +++- plugins/gzip/Makefile.am | 4 +++- plugins/libvirt/Makefile.am | 4 +++- plugins/ocaml/Makefile.am | 4 +++- plugins/perl/Makefile.am | 4 +++- plugins/perl/perl.c | 9 +++++---- plugins/python/Makefile.am | 4 +++- plugins/ruby/Makefile.am | 4 +++- plugins/streaming/Makefile.am | 4 +++- plugins/vddk/Makefile.am | 4 +++- plugins/xz/Makefile.am | 4 +++- 20 files changed, 60 insertions(+), 31 deletions(-) -- 2.9.3
Eric Blake
2017-Jan-31 21:00 UTC
[Libguestfs] [nbdkit PATCH 1/2] perl: Fix previous patches
Avoid calling nbdkit_set_error with a possibly stale value from a previous API call; and fix inadvertent hard TABs and malformed POD text. Signed-off-by: Eric Blake <eblake@redhat.com> --- docs/nbdkit-plugin.pod | 2 +- plugins/perl/perl.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod index 4b3a492..3611244 100644 --- a/docs/nbdkit-plugin.pod +++ b/docs/nbdkit-plugin.pod @@ -483,7 +483,7 @@ bytes of zeroes at C<offset> in the backing store. If C<may_trim> is non-zero, the operation can punch a hole instead of writing actual zero bytes, but only if subsequent reads from the hole read as zeroes. If this callback is omitted, or if it fails with C<EOPNOTSUPP> -(whether by C<nbdkit_set_error or C<errno>), then C<.pwrite> will be +(whether by C<nbdkit_set_error> or C<errno>), then C<.pwrite> will be used instead. The callback must write the whole C<count> bytes if it can. The NBD diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 52694d9..317a775 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -147,9 +147,10 @@ XS(set_error) { dXSARGS; /* Is it worth adding error checking for bad arguments? */ - if (items >= 1) + if (items >= 1) { last_error = SvIV (ST (0)); - nbdkit_set_error (last_error); + nbdkit_set_error (last_error); + } XSRETURN_EMPTY; } @@ -539,8 +540,8 @@ perl_zero (void *handle, uint32_t count, uint64_t offset, int may_trim) if (last_error == EOPNOTSUPP) { /* When user requests this particular error, we want to - gracefully fall back, and to accomodate both a normal return - and an exception. */ + gracefully fall back, and to accomodate both a normal return + and an exception. */ nbdkit_debug ("zero requested falling back to pwrite"); return -1; } -- 2.9.3
Eric Blake
2017-Jan-31 21:00 UTC
[Libguestfs] [nbdkit PATCH 2/2] build: Kill build on POD error
I recently introduced (and fixed) a POD error that escaped detection because make did not die. As penance, I'm improving the build machinery, borrowing ideas from libvirt. The pod2man shipped in perl-podlators 4.09 (Fedora 25) defaults to '--errors=die' which prints the errors and exits with a non-zero status on any problem; but for back-compat, if --stderr is used, this overrides the default, and ends up still printing warnings to stderr but with no change to exit status (effectively ignoring errors). Omitting --stderr is thus saner behavior; grepping for 'POD ERRORS' will never succeed, but doesn't matter because the pod2man call itself fails. The pod2man shipped with perl 5.10 (RHEL 6 timeframe) lacks '--errors=die' but has '--stderr'; there the use of '--stderr' prints errors to stderr instead of to a 'POD ERRORS' section of the output, but does not affect exit status. Omitting --stderr means that you no longer see the error, but adding the grep for 'POD ERRORS' will at least halt the build. The pod2man shipped with perl 5.8 (RHEL 5 timeframe) lacks '--stderr', and always spits errors to stderr with a 0 exit status; it never produces a 'POD ERRORS' section in the output. Lame, but it merely means that someone developing on RHEL 5 won't catch pod errors until they rebuild on a newer platform. Signed-off-by: Eric Blake <eblake@redhat.com> --- .gitignore | 2 ++ configure.ac | 10 +--------- docs/Makefile.am | 8 ++++++-- plugins/curl/Makefile.am | 4 +++- plugins/example1/Makefile.am | 4 +++- plugins/example2/Makefile.am | 4 +++- plugins/example3/Makefile.am | 4 +++- plugins/file/Makefile.am | 4 +++- plugins/guestfs/Makefile.am | 4 +++- plugins/gzip/Makefile.am | 4 +++- plugins/libvirt/Makefile.am | 4 +++- plugins/ocaml/Makefile.am | 4 +++- plugins/perl/Makefile.am | 4 +++- plugins/python/Makefile.am | 4 +++- plugins/ruby/Makefile.am | 4 +++- plugins/streaming/Makefile.am | 4 +++- plugins/vddk/Makefile.am | 4 +++- plugins/xz/Makefile.am | 4 +++- 18 files changed, 54 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index f8918a7..59e9510 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *~ *.1 +*.1.t *.3 +*.3.t *.cmi *.cmx *.la diff --git a/configure.ac b/configure.ac index d521c81..13c724b 100644 --- a/configure.ac +++ b/configure.ac @@ -130,8 +130,7 @@ dnl Check for Perl POD. AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [no]) AS_IF([test "x$POD2MAN" != "xno"],[ POD2MAN_ARGS="--center=nbdkit --release=nbdkit" - # Check that pod2man supports --utf8 and --stderr options, and if so - # add them to $POD2MAN_ARGS. + # Check whether pod2man supports --utf8, and if so add it to $POD2MAN_ARGS. AC_MSG_CHECKING([if $POD2MAN supports --utf8]) AS_IF([$POD2MAN --help 2>&1 | grep -s -q -- --utf8],[ AC_MSG_RESULT([yes]) @@ -139,13 +138,6 @@ AS_IF([test "x$POD2MAN" != "xno"],[ ],[ AC_MSG_RESULT([no]) ]) - AC_MSG_CHECKING([if $POD2MAN supports --stderr]) - AS_IF([$POD2MAN --help 2>&1 | grep -s -q -- --stderr],[ - AC_MSG_RESULT([yes]) - POD2MAN_ARGS="$POD2MAN_ARGS --stderr" - ],[ - AC_MSG_RESULT([no]) - ]) AC_SUBST([POD2MAN_ARGS]) ]) AM_CONDITIONAL([HAVE_POD2MAN], [test "x$POD2MAN" != "xno"]) diff --git a/docs/Makefile.am b/docs/Makefile.am index 929b3d6..323f48d 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -44,9 +44,13 @@ man_MANS = \ CLEANFILES += $(man_MANS) nbdkit.1: nbdkit.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=nbdkit $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=nbdkit $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ nbdkit-plugin.3: nbdkit-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=nbdkit-plugin $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=nbdkit-plugin $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/curl/Makefile.am b/plugins/curl/Makefile.am index a53d255..58763a9 100644 --- a/plugins/curl/Makefile.am +++ b/plugins/curl/Makefile.am @@ -60,7 +60,9 @@ man_MANS = nbdkit-curl-plugin.1 CLEANFILES += $(man_MANS) nbdkit-curl-plugin.1: nbdkit-curl-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/example1/Makefile.am b/plugins/example1/Makefile.am index 1323d86..1505e53 100644 --- a/plugins/example1/Makefile.am +++ b/plugins/example1/Makefile.am @@ -55,6 +55,8 @@ man_MANS = nbdkit-example1-plugin.1 CLEANFILES += $(man_MANS) nbdkit-example1-plugin.1: nbdkit-example1-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/example2/Makefile.am b/plugins/example2/Makefile.am index 68ea14b..0c209d3 100644 --- a/plugins/example2/Makefile.am +++ b/plugins/example2/Makefile.am @@ -55,6 +55,8 @@ man_MANS = nbdkit-example2-plugin.1 CLEANFILES += $(man_MANS) nbdkit-example2-plugin.1: nbdkit-example2-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/example3/Makefile.am b/plugins/example3/Makefile.am index 7728445..9db42bc 100644 --- a/plugins/example3/Makefile.am +++ b/plugins/example3/Makefile.am @@ -55,6 +55,8 @@ man_MANS = nbdkit-example3-plugin.1 CLEANFILES += $(man_MANS) nbdkit-example3-plugin.1: nbdkit-example3-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/file/Makefile.am b/plugins/file/Makefile.am index 20f198f..a9d9308 100644 --- a/plugins/file/Makefile.am +++ b/plugins/file/Makefile.am @@ -55,6 +55,8 @@ man_MANS = nbdkit-file-plugin.1 CLEANFILES += $(man_MANS) nbdkit-file-plugin.1: nbdkit-file-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/guestfs/Makefile.am b/plugins/guestfs/Makefile.am index eebed25..578b2fa 100644 --- a/plugins/guestfs/Makefile.am +++ b/plugins/guestfs/Makefile.am @@ -60,7 +60,9 @@ man_MANS = nbdkit-guestfs-plugin.1 CLEANFILES += $(man_MANS) nbdkit-guestfs-plugin.1: nbdkit-guestfs-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/gzip/Makefile.am b/plugins/gzip/Makefile.am index 3b30eb9..71fa1f6 100644 --- a/plugins/gzip/Makefile.am +++ b/plugins/gzip/Makefile.am @@ -60,7 +60,9 @@ man_MANS = nbdkit-gzip-plugin.1 CLEANFILES += $(man_MANS) nbdkit-gzip-plugin.1: nbdkit-gzip-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/libvirt/Makefile.am b/plugins/libvirt/Makefile.am index ec38f9b..f8a616d 100644 --- a/plugins/libvirt/Makefile.am +++ b/plugins/libvirt/Makefile.am @@ -60,7 +60,9 @@ man_MANS = nbdkit-libvirt-plugin.1 CLEANFILES += $(man_MANS) nbdkit-libvirt-plugin.1: nbdkit-libvirt-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/ocaml/Makefile.am b/plugins/ocaml/Makefile.am index 24a4c7b..653a2f2 100644 --- a/plugins/ocaml/Makefile.am +++ b/plugins/ocaml/Makefile.am @@ -73,7 +73,9 @@ man_MANS = nbdkit-ocaml-plugin.3 CLEANFILES += $(man_MANS) nbdkit-ocaml-plugin.3: nbdkit-ocaml-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/perl/Makefile.am b/plugins/perl/Makefile.am index ab11ecc..1b9ae18 100644 --- a/plugins/perl/Makefile.am +++ b/plugins/perl/Makefile.am @@ -62,7 +62,9 @@ man_MANS = nbdkit-perl-plugin.3 CLEANFILES += $(man_MANS) nbdkit-perl-plugin.3: nbdkit-perl-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am index ec60dfe..fe5872a 100644 --- a/plugins/python/Makefile.am +++ b/plugins/python/Makefile.am @@ -63,7 +63,9 @@ man_MANS = nbdkit-python-plugin.3 CLEANFILES += $(man_MANS) nbdkit-python-plugin.3: nbdkit-python-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/ruby/Makefile.am b/plugins/ruby/Makefile.am index 3038503..a7e44f3 100644 --- a/plugins/ruby/Makefile.am +++ b/plugins/ruby/Makefile.am @@ -63,7 +63,9 @@ man_MANS = nbdkit-ruby-plugin.3 CLEANFILES += $(man_MANS) nbdkit-ruby-plugin.3: nbdkit-ruby-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=3 --name=`basename $@ .3` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/streaming/Makefile.am b/plugins/streaming/Makefile.am index 718c917..10518fb 100644 --- a/plugins/streaming/Makefile.am +++ b/plugins/streaming/Makefile.am @@ -55,6 +55,8 @@ man_MANS = nbdkit-streaming-plugin.1 CLEANFILES += $(man_MANS) nbdkit-streaming-plugin.1: nbdkit-streaming-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/vddk/Makefile.am b/plugins/vddk/Makefile.am index abddcea..c79e594 100644 --- a/plugins/vddk/Makefile.am +++ b/plugins/vddk/Makefile.am @@ -60,7 +60,9 @@ man_MANS = nbdkit-vddk-plugin.1 CLEANFILES += $(man_MANS) nbdkit-vddk-plugin.1: nbdkit-vddk-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif diff --git a/plugins/xz/Makefile.am b/plugins/xz/Makefile.am index b180a67..25f6e31 100644 --- a/plugins/xz/Makefile.am +++ b/plugins/xz/Makefile.am @@ -64,7 +64,9 @@ man_MANS = nbdkit-xz-plugin.1 CLEANFILES += $(man_MANS) nbdkit-xz-plugin.1: nbdkit-xz-plugin.pod - $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@ + $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \ + if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \ + mv $@.t $@ endif -- 2.9.3
Richard W.M. Jones
2017-Jan-31 21:25 UTC
Re: [Libguestfs] [nbdkit PATCH 0/2] fix pod and other errors in recent patches
On Tue, Jan 31, 2017 at 03:00:33PM -0600, Eric Blake wrote:> POD errors are not nice, and 'pod2man --stderr' does not do what we > want.Thanks - I pushed both. I agree that on RHEL 5 we only really care that it doesn't fail to compile. It doesn't matter even if the man page is generated incorrectly on that platform. Rich. -- 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. http://libguestfs.org/virt-v2v
Possibly Parallel Threads
- [PATCH nbdkit 0/4] plugins: Add new "ext2" plugin, for accessing ext2, ext3 or ext4 filesystems.
- [PATCH nbdkit INCOMPLETE 0/6] Introduce filters to nbdkit.
- [PATCH nbdkit filters-v3 0/7] Introduce filters.
- [PATCH hivex 02/14] maint: remove unnecessary test-before-free
- [PATCH nbdkit filters-v2 0/5] Introduce filters.