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

Bug#535308: Manpages check script doesn't ignore draft mode



Package: lintian
Version: 2.2.12
Tags: patch

Hyphens used as minus signs warning shouldn't be displayed when
strings are contained in pargraph written in draft_mode [1].
To reproduce the bug:

wget http://ftp.us.debian.org/debian/pool/main/s/slurm-llnl/slurm-llnl_1.3.6-1lenny3_i386.deb
lintian -I slurm-llnl_1.3.6-1lenny3_i386.deb

Attached a patch that fix the problem.
I am using testing with kernel 2.6.26-2-686 and perl 5.10.0-23

[1] http://man-wiki.net/index.php/5:groff_tmac#Draft_Mode
-- 
Gennaro Oliva
--- /usr/share/lintian/checks/manpages	2009-06-19 02:22:54.000000000 +0200
+++ /home/oliva/manpages	2009-07-01 14:35:04.000000000 +0200
@@ -274,6 +274,7 @@
 	# Now we search through the whole man page for some common errors
 	my $lc = 0;
 	my $hc = 0;
+	my $draft_mode=0;
 	foreach my $line (@manfile) {
 	    $lc++;
 	    chomp $line;
@@ -289,14 +290,23 @@
 	    # Catch hyphens used as minus signs by looking for ones at the
 	    # beginning of a word, but don't generate false positives on \s-1
 	    # (small font), \*(-- (pod2man long dash), or things like \h'-1'.
+	    # Ignoring hyphens contained in draft mode (.eo).
+	    if ($line =~ /^\.eo/) {
+		$draft_mode=1;
+	    }
+	    if ($line =~ /^\.ec/) {
+		$draft_mode=0;
+            }
 	    if ($line =~ /^(
 			    ([^\.].*)?
 			    [\s\'\"\`\(\[]
 			    (?<! \\s | \*\( | \(- | \w\' )
 			   )?
 			   (--?\w+)/ox) {
-		$hc++;
-		tag "hyphen-used-as-minus-sign", "$file:$lc" if $hc <= 10 or $ENV{'LINTIAN_DEBUG'};
+		if ($draft_mode==0) {
+			$hc++;
+			tag "hyphen-used-as-minus-sign", "$file:$lc" if $hc <= 10 or $ENV{'LINTIAN_DEBUG'};
+		}
 	    }
 	    if (($line =~ m,(/usr/(dict|doc|etc|info|man|adm|preserve)/),o)
 		|| ($line =~ m,(/var/(adm|catman|named|nis|preserve)/),o)) {

Reply to: