lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190112122856.18440-3-bluca@debian.org>
Date:   Sat, 12 Jan 2019 12:28:56 +0000
From:   Luca Boccassi <bluca@...ian.org>
To:     netdev@...r.kernel.org
Cc:     stephen@...workplumber.org, Luca Boccassi <bluca@...ian.org>
Subject: [PATCH iproute2 3/3] Makefile: check manpages for syntax errors

Pass the same parameters Lintian uses in Debian.

$ make check
<...>
Checking manpages for syntax errors...
<standard input>:48: warning: macro `Q' not defined
Error in tc-taprio.8
Makefile:27: recipe for target 'check' failed

Signed-off-by: Luca Boccassi <bluca@...ian.org>
---
As far as I can see all the shell-ery should be portable and not
bash specific. Do not error out if man is not present, to avoid
issues on minimal build workers. The rest comes from coreutils
(tee, wc) so we can assume they are available.

 Makefile          | 6 ++++++
 man/Makefile      | 9 +++++++--
 man/man3/Makefile | 6 +++++-
 man/man7/Makefile | 6 +++++-
 man/man8/Makefile | 6 +++++-
 5 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index a513cf38..48f469b0 100644
--- a/Makefile
+++ b/Makefile
@@ -115,6 +115,12 @@ distclean: clobber
 
 check: all
 	cd testsuite && $(MAKE) && $(MAKE) alltests
+	@if command -v man >/dev/null 2>&1; then \
+		echo "Checking manpages for syntax errors..."; \
+		$(MAKE) -C man check; \
+	else \
+		echo "man not installed, skipping checks for syntax errors."; \
+	fi
 
 cscope:
 	cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
diff --git a/man/Makefile b/man/Makefile
index 6b095ee4..0c759dd2 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -2,14 +2,19 @@
 INSTALL=install
 INSTALLDIR=install -m 0755 -d
 INSTALLMAN=install -m 0644
+# Pass the same parameters as Lintian uses on Debian.
+MAN_CHECK=LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings \
+	--encoding=UTF-8 --local-file --troff-device=utf8 --ditroff
+# Hide man output, count and print errors.
+MAN_REDIRECT=2>&1 >/dev/null | tee /dev/fd/2 | wc -l
 
 SUBDIRS = man3 man7 man8
 
-all clean install:
+all clean install check:
 	@for subdir in $(SUBDIRS); do $(MAKE) -C $$subdir $@ || exit $$?; done
 
 distclean: clean
 
-.PHONY: install clean distclean
+.PHONY: install clean distclean check
 
 .EXPORT_ALL_VARIABLES:
diff --git a/man/man3/Makefile b/man/man3/Makefile
index e3d3e607..1732be26 100644
--- a/man/man3/Makefile
+++ b/man/man3/Makefile
@@ -11,4 +11,8 @@ install:
 	$(INSTALLDIR) $(DESTDIR)$(MANDIR)/man3
 	$(INSTALLMAN) $(MAN3PAGES) $(DESTDIR)$(MANDIR)/man3
 
-.PHONY: install clean distclean
+check:
+	@for page in $(MAN3PAGES); do test 0 -eq $$($(MAN_CHECK) $$page \
+		$(MAN_REDIRECT)) || { echo "Error in $$page"; exit 1; }; done
+
+.PHONY: install clean distclean check
diff --git a/man/man7/Makefile b/man/man7/Makefile
index 1a8d5219..c0e545a1 100644
--- a/man/man7/Makefile
+++ b/man/man7/Makefile
@@ -11,4 +11,8 @@ install:
 	$(INSTALLDIR) $(DESTDIR)$(MANDIR)/man7
 	$(INSTALLMAN) $(MAN7PAGES) $(DESTDIR)$(MANDIR)/man7
 
-.PHONY: install clean distclean
+check:
+	@for page in $(MAN7PAGES); do test 0 -eq $$($(MAN_CHECK) $$page \
+		$(MAN_REDIRECT)) || { echo "Error in $$page"; exit 1; }; done
+
+.PHONY: install clean distclean check
diff --git a/man/man8/Makefile b/man/man8/Makefile
index 932ba1f3..0269e174 100644
--- a/man/man8/Makefile
+++ b/man/man8/Makefile
@@ -23,4 +23,8 @@ install:
 	$(INSTALLDIR) $(DESTDIR)$(MANDIR)/man8
 	$(INSTALLMAN) $(MAN8PAGES) $(DESTDIR)$(MANDIR)/man8
 
-.PHONY: install clean distclean
+check: all
+	@for page in $(MAN8PAGES); do test 0 -eq $$($(MAN_CHECK) $$page \
+		$(MAN_REDIRECT)) || { echo "Error in $$page"; exit 1; }; done
+
+.PHONY: install clean distclean check
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ