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

Bug#501722: lintian: unused-override is emitted when an override exists for a check which is not -C <check>



On Thu, 2008-10-30 at 18:43 +0000, Adam D. Barratt wrote:
> On Thu, 2008-10-09 at 15:12 -0500, Raphael Geissert wrote:
> > $ lintian --show-overrides -C scripts -I 
> > xserver-xorg-video-openchrome_0.2.902+svn579-2_i386.deb | cut '-d ' -f-3
> > I: xserver-xorg-video-openchrome: unused-override
> > I: xserver-xorg-video-openchrome: unused-override
> > I: xserver-xorg-video-openchrome: unused-override
> > I: xserver-xorg-video-openchrome: unused-override
> > I: xserver-xorg-video-openchrome: unused-override
> > 
> > Lintian should either not emit unused-override at all (only in that case, of 
> > course) or should only do it for tags that belong to the same check.
> > 
> > PS. -T is not affected.
> 
> -T /is/ affected, just differently: (apologies for the horrible
> wrapping)

I've attached my proposed patch for this, which I believe does the right
thing in all cases; comments welcome (particularly on whether my
definition of "right" is correct :-)

By way of some examples:

ocaml-compiler-libs
-------------------

The package includes an override for
copyright-should-refer-to-common-license-file-for-lgpl and lintian
issues command-with-path-in-maintainer-script.

With "-C scripts" no unused override warning is issued, c-w-p-i-m-s is.
With "-T command-with-path-in-maintainer-script" no unused override
warning is issued, c-w-p-i-m-s is.

adduser
-------

The package includes three unused overrides for
maintainer-script-needs-depends-on-adduser and lintian issues a number
of tags from the files and manpages check scripts.

With "-C scripts" the unused override warning is issued; with either "-C
manpages" or "-C files" it is not.

With "-T maintainer-script-needs-depends-on-adduser" or "-T
unused-override", no output is produced.

With "-T maintainer-script-needs-depends-on-adduser,unused-override" the
unused overrides are flagged.

Regards,

Adam
diff --git a/frontend/lintian b/frontend/lintian
index 2e33ff0..564875a 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1544,6 +1544,16 @@ foreach my $pkg_info ($schedule->get_all) {
 	    my $overrides = Tags::get_overrides( $file );
 
 	    for my $tag (sort keys %$overrides) {
+		my $taginfo = Tags::get_tag_info{$tag};
+		if (defined $taginfo) {
+		    # Did we run the check script containing the tag?
+		    next unless $checks{$taginfo->{'script'}};
+
+		    # If only checking specific tags, is this one of them?
+		    next unless (scalar keys %Tags::only_issue_tags == 0)
+			or exists $Tags::only_issue_tags{$tag};
+		}
+
 		for my $extra (sort keys %{$overrides->{$tag}}) {
 		    next if $overrides->{$tag}{$extra};
 

Reply to: