Author: djpig
Date: 2005-07-23 18:39:13 +0200 (Sat, 23 Jul 2005)
New Revision: 454

Modified:
   trunk/checks/manpages
   trunk/checks/manpages.desc
   trunk/debian/changelog
Log:
Report errors from man when parsing man pages. Based on
a patch by Kevin Ryde (Closes: #285540)


Modified: trunk/checks/manpages
===================================================================
--- trunk/checks/manpages       2005-07-23 15:47:49 UTC (rev 453)
+++ trunk/checks/manpages       2005-07-23 16:39:13 UTC (rev 454)
@@ -200,8 +200,8 @@
            my ($i, $first) = (0, "");
            do {
                $first = $manfile[$i++] || ""; 
-           } while ($first =~ /^\.\\"/ && $manfile[$i]);
-           
+           } while ($first =~ /^\.\\"/ && $manfile[$i]); #");
+
            unless ($first) {
                tag "empty-manual-page", "$file";
            } elsif ($first =~ /^\.so\s+(.+)?$/) {
@@ -236,9 +236,24 @@
        # removed.
        if ($path =~ m,/man/man\d/,) {
            if (system("lexgrog unpacked/\Q$file\E >/dev/null 2>&1")) {
-               tag "manpage-has-bad-whatis-entry", "$file";
+               tag "manpage-has-bad-whatis-entry", "$file";
            }
        }
+       # If it's not a .so link, run it through "man" to check for errors.
+       open MANERRS, '-|', "(LANG=C man -l unpacked/\Q$file\E >/dev/null) 2>&1"
+           or fail("cannot run man -l: $!");
+       while (<MANERRS>) {
+           # ignore progress information from man
+           next if /^Reformatting/;
+           next if /^\s*$/;
+           # ignore errors from gzip, will be dealt with at other places
+           next if /^(man|gzip)/;
+           chomp;
+           s/^[^:]://o;
+           tag "manpage-has-errors-from-man", "$file", "$_";
+           last;
+       }
+       close(MANERRS);
        # Now we search through the whole man page for some common errors
        my $lc = 0;
        my $hc = 0;
@@ -248,7 +263,7 @@
            next if $line =~ /^\.\\\"/o; # comments .\"
            if ($line =~ /^\.TH\s/) { # header
                require Text::ParseWords;
-               my ($th_command, $th_title, $th_section, $th_date ) = 
+               my ($th_command, $th_title, $th_section, $th_date ) =
                    Text::ParseWords::parse_line( '\s+', 0, $line);
                if ($th_section && (lc($fn_section) ne lc($th_section))) {
                    tag "manpage-section-mismatch", "$file:$lc $fn_section != 
$th_section";

Modified: trunk/checks/manpages.desc
===================================================================
--- trunk/checks/manpages.desc  2005-07-23 15:47:49 UTC (rev 453)
+++ trunk/checks/manpages.desc  2005-07-23 16:39:13 UTC (rev 454)
@@ -95,6 +95,27 @@
  See also groff_man(7) and groff_mdoc(7) for general information on writing
  manual pages.
 
+Tag: manpage-has-errors-from-man
+Type: warning
+Info: This man page provokes warnings or errors from man.
+ .
+ "cannot adjust" or "can't break" are trouble with paragraph filling,
+ usually related to long lines.  Adjustment can be helped by left
+ justifying, breaks can be helped with hyphenation, see "Manipulating
+ Filling and Adjusting" and "Manipulating Hyphenation" in the manual.
+ .
+ "can't find numbered character" usually means latin1 etc in the input, and
+ this warning indicates characters will be missing from the output.  You can
+ change to escapes like \[:a] described on the groff_char man page.
+ .
+ Other warnings are often formatting typos, like missing quotes around a
+ string argument to .IP.  These are likely to result in lost or malformed
+ output.  See the groff_man (or groff_mdoc if using mdoc) man page for
+ information on macros.
+ .
+ At worst, warning messages can be disabled with the .warn directive, see
+ "Debugging" in the groff manual.
+
 Tag: manpage-for-x11-binary-in-wrong-directory
 Type: error
 Info: Manual pages for binaries which are located in <tt>/usr/X11R6/bin</tt>

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2005-07-23 15:47:49 UTC (rev 453)
+++ trunk/debian/changelog      2005-07-23 16:39:13 UTC (rev 454)
@@ -25,6 +25,9 @@
       just on zero-length lines. (Closes: #319370)
   * checks/fields:
     + [FL] Actually mention which architecture we're complaining about
+  * checks/manpages:
+    + [FL] Report errors from man when parsing man pages. Based on
+      a patch by Kevin Ryde (Closes: #285540)
   * checks/po-debconf:
     + [FL] Abort check if the package doesn't seem to use debconf to
       avoid false positives in case maintainers use debian/po for


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to