>>>>> Colin Watson <[EMAIL PROTECTED]> writes: >> In a recent thread in debian-devel, it was suggested that lintian >> could call man(1) in such a way that the groff(1), called by `man', >> will emit warnings for every undefined macro, which is useful in >> catching the bugs like this:
>> .B foo >> . Note: ... >> Below is the patch that implements the suggestion. Since `man' >> doesn't allow the `-wmac' option to be passed to `groff' by any >> other means, I've had to introduce two new files -- `mdoc.local' and >> `man.local' (to override the files in groff/site-tmac/), and the >> ${LINTIAN_ROOT}/groff-hack directory to hold them. > While I haven't reviewed the code in detail, the general approach > seems largely reasonable to me. However, the error the developer sees > will just be "manpage-has-errors-from-man", which in fact is no > longer really true in this case; you're specifically enabling > warnings that man doesn't show. Perhaps it would be best to turn > these warnings from groff into a different lintian warning which can > have a more informative description, and ideally a way for the > developer to reproduce the problem. A helper script, `lintian-man', could be introduced to hide all the hackery, and to provide a way for the developer to reproduce the problem. Then, Tag: may be changed to, e. g., `manpage-has-messages-from-lintian-man'. (Or should this script be called `man-lintian'?) I still hope that either `groff' or `man' will offer a way to specify `-w'-options for `groff' in a more clean way. The helper script could then be modified, or eliminated entirely. The patch is as follows. (TODO: newly introduced lintian-man script demands a man page on its own.) This new version of the patch suppresses `.IX'-related warnings. (TODO: the generator is to be fixed.) --- lintian-1.23.36/checks/manpages 2007-10-16 10:40:04.000000000 +0700 +++ lintian-1.23.36-groff-hack/checks/manpages 2007-11-21 21:16:29.000000000 +0600 @@ -253,10 +253,11 @@ # processed properly. (Yes, there are man pages that include other # pages with .so but aren't simple links; rbash, for instance.) my $cmd; + my $man_cmd = "lintian-man -l"; if ($file =~ m,^(.*)/(man\d/.*)$,) { - $cmd = "cd unpacked/\Q$1\E && man -l \Q$2\E"; + $cmd = "cd unpacked/\Q$1\E && $man_cmd \Q$2\E"; } else { - $cmd = "man -l unpacked/\Q$file\E"; + $cmd = "$man_cmd unpacked/\Q$file\E"; } my $pid = open MANERRS, '-|'; if (not defined $pid) { @@ -282,7 +283,7 @@ } chomp; s/^[^:]+://o; - tag "manpage-has-errors-from-man", "$file", "$_"; + tag "manpage-has-messages-from-lintian-man", "$file", "$_"; last; } close(MANERRS); --- lintian-1.23.36/checks/manpages.desc 2007-06-21 15:48:26.000000000 +0700 +++ lintian-1.23.36-groff-hack/checks/manpages.desc 2007-11-21 21:16:26.000000000 +0600 @@ -120,9 +120,12 @@ Please double-check the manual page and replace the template language with specific information about this program. -Tag: manpage-has-errors-from-man +Tag: manpage-has-messages-from-lintian-man Type: warning -Info: This man page provokes warnings or errors from man. +Info: This man page provokes warnings or errors from lintian-man. + . + lintian-man is a helper script which behaves like man, but with Groff + warnings (-wman) explicitly enabled. . "cannot adjust" or "can't break" are trouble with paragraph filling, usually related to long lines. Adjustment can be helped by left --- lintian-1.23.36/debian/rules 2006-11-19 07:11:32.000000000 +0600 +++ lintian-1.23.36-groff-hack/debian/rules 2007-11-21 21:18:13.000000000 +0600 @@ -43,9 +43,12 @@ install -m 755 frontend/lintian $(tmp)/usr/bin/ sed -i 's/<VERSION>/$(VER)/' $(tmp)/usr/bin/lintian install -m 755 frontend/lintian-info $(tmp)/usr/bin/ +# helper scripts + @echo .... install helper scripts .... + install -m 755 frontend/lintian-man $(tmp)/usr/bin/ # library files @echo .... install library files .... - for d in checks collection lib unpack; do \ + for d in checks collection lib unpack groff-hacks; do \ install -d $(usl)/$$d; \ find $$d -type f ! -path '*/CVS/*' ! -path '*/.svn/*' \ | xargs -iFILE cp -p FILE $(usl)/$$d/; \ --- lintian-1.23.36/frontend/lintian-man 1970-01-01 07:00:00.000000000 +0700 +++ lintian-1.23.36-groff-hack/frontend/lintian-man 2007-11-21 21:16:48.000000000 +0600 @@ -0,0 +1,5 @@ +#!/bin/sh +: ${LINTIAN_ROOT:=/usr/share/lintian} +export \ + GROFF_TMAC_PATH="${LINTIAN_ROOT}${GROFF_TMAC_PATH:+:}${GROFF_TMAC_PATH}" +exec man "$@" --- lintian-1.23.36/groff-hacks/man.local 1970-01-01 07:00:00.000000000 +0700 +++ lintian-1.23.36-groff-hack/groff-hacks/man.local 2007-11-21 21:27:56.000000000 +0600 @@ -0,0 +1,4 @@ +.warn 512 +.mso /usr/share/groff/site-tmac/man.local +.de IX +.. --- lintian-1.23.36/groff-hacks/mdoc.local 1970-01-01 07:00:00.000000000 +0700 +++ lintian-1.23.36-groff-hack/groff-hacks/mdoc.local 2007-11-21 21:27:45.000000000 +0600 @@ -0,0 +1,4 @@ +.warn 512 +.mso /usr/share/groff/site-tmac/mdoc.local +.de IX +.. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]