[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#377392: lintian: Please add a check for macros in manpages



Package: lintian
Version: 1.23.22
Severity: wishlist
Tags: patch

Hi,

Checking the validity with the "man" command does not report errors
about macros. The workaround is to use "groff -wmac".

The result of a wrong macro is often a missing line in the displayed
manpage. For example, shmget.2 (manpages-dev) contains the undefined
macro ".Br proc (5)." instead of ".BR proc (5)". If you have a look at
the displayed manpage, you will see that "proc(5)." is missing at the
end of the following sentence:
 "See also the discussion of the file /proc/sys/vm/overcommit_memory in"


The attached patch should allow lintian to warn about these problems.

Cheers,

-- 
Thomas Huriaux
--- manpages.orig	2006-07-08 17:55:18.000000000 +0200
+++ manpages	2006-07-08 17:51:51.000000000 +0200
@@ -245,20 +245,31 @@
 	# processed properly.  (Yes, there are man pages that include other
 	# pages with .so but aren't simple links; rbash, for instance.)
 	my $cmd;
+	my $groff_cmd;
+	my $gzip_cmd;
+	if ($file =~ m,\.gz$,) {
+	  $gzip_cmd = "gunzip -c";
+	} else {
+	  $gzip_cmd = "cat";
+	}
 	if ($file =~ m,^(.*)/(man\d/.*)$,) {
-	    $cmd = "cd unpacked/\Q$1\E && man -l \Q$2\E";
+	    $groff_cmd = `cd unpacked/\Q$1\E && $gzip_cmd \Q$2\E | grog -wmac -Tascii 2>/dev/null`;
+	    chomp $groff_cmd;
+	    $cmd = "cd unpacked/\Q$1\E && $gzip_cmd \Q$2\E | $groff_cmd";
 	} else {
-	    $cmd = "man -l unpacked/\Q$file\E";
+	    $groff_cmd = `$gzip_cmd unpacked/\Q$file\E | grog -wmac -Tascii 2>/dev/null`;
+	    chomp $groff_cmd;
+	    $cmd = "$gzip_cmd unpacked/\Q$file\E | $groff_cmd";
 	}
 	my $pid = open MANERRS, '-|';
 	if (not defined $pid) {
-	    fail("cannot run man -l: $!");
+	    fail("cannot run $cmd: $!");
 	} elsif ($pid == 0) {
 	    my %newenv = (LANG => 'C', PATH => $ENV{PATH});
 	    undef %ENV;
 	    %ENV = %newenv;
 	    exec "($cmd >/dev/null) 2>&1"
-		or fail("cannot run man -l: $!");
+		or fail("cannot run $cmd: $!");
 	}
 	while (<MANERRS>) {
 	    # ignore progress information from man
@@ -266,6 +277,10 @@
 	    next if /^\s*$/;
 	    # ignore errors from gzip, will be dealt with at other places
 	    next if /^(man|gzip)/;
+	    # this macro is included by pod2man
+	    next if /warning: \`IX\' not defined/;
+	    # .so links are checked somewhere else
+	    next if /can't open \`(.*)\': No such file or directory/;
 	    # ignore 8bit character errors on localized man pages
 	    if ($lang ne "") {
 		next if /warning: can\'t find numbered character/;

Attachment: signature.asc
Description: Digital signature


Reply to: