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 <ebl...@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 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs