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

Bug#518966: lintian: check/scripts remove-of-unknown-diversion is bogus



On Mon, 2009-03-09 at 11:29 -0700, Russ Allbery wrote:
> Norbert Preining <preining@logic.at> writes:
> > On Mo, 09 Mär 2009, Adam D. Barratt wrote:
> 
> >> Is this for any of the versions of luatex currently in the archive or
> >> incoming? I've just built both 0.28.0-2 (unstable) and 0.30.3-1
> >> (experimental) locally in an amd64 pbuilder and downloaded the 0.35.0-1
> >
> > Incoming, I checked before uploading and I get this one:
[...]
> > E: luatex: remove-of-unknown-diversion usr/bin/texdoc postrm:11
> > E: luatex: remove-of-unknown-diversion usr/share/man/man1/texdoc.1.gz postrm:14
> > E: luatex: orphaned-diversion usr/bin/texdoc preinst
> > E: luatex: orphaned-diversion usr/share/man/man1/texdoc.1.gz preinst
[...]
> Oh, wait.  I know what's wrong.  Ugh.  The current code depends on the
> order in which the maintainer scripts are seen.  I'll try to get this
> fixed ASAP (but probably not before this evening my time).

Hope you don't mind, Russ, but I had a quick look at a patch for this.
Norbert, could you please apply the diff below (relative
to /usr/share/lintian) and see if that fixes things for you?

diff --git a/checks/scripts b/checks/scripts
index 8f89194..e3c1205 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -527,6 +527,7 @@ open(SCRIPTS, '<', "control-scripts")
 # make a shared function awkward.
 
 my %added_diversions;
+my %removed_diversions;
 while (<SCRIPTS>) {
     chop;
 
@@ -886,17 +887,7 @@ while (<SCRIPTS>) {
                    tag 'diversion-for-unknown-file', $divert, "$file:$."
                        unless (exists $info->index->{$divert});
                } elsif ($mode eq 'remove') {
-                   if (exists $added_diversions{$divert}) {
-                       # do not really delete the entry, because a --remove
-                       # might happen in two branches in the script, i.e. we
-                       # see it twice, which is not a bug
-                       undef $added_diversions{$divert};
-                   } elsif ($file eq 'postrm') {
-                       # Allow preinst and postinst to remove diversions the
-                       # package doesn't add to clean up after previous
-                       # versions of the package.
-                       tag 'remove-of-unknown-diversion', $divert, "$file:$.";
-                   }
+                   $removed_diversions{$divert} = [ $file, $. ];
                } else {
                    fail "Internal error: \$mode has unknown value: ".
                        "$mode";
@@ -924,6 +915,23 @@ while (<SCRIPTS>) {
 }
 close(SCRIPTS);
 
+for my $divert (keys %removed_diversions) {
+    my $file = $removed_diversions{$divert}[0];
+    my $line = $removed_diversions{$divert}[1];
+
+    if (exists $added_diversions{$divert}) {
+       # do not really delete the entry, because a --remove
+       # might happen in two branches in the script, i.e. we
+       # see it twice, which is not a bug
+       undef $added_diversions{$divert};
+    } elsif ($file eq 'postrm') {
+       # Allow preinst and postinst to remove diversions the
+       # package doesn't add to clean up after previous
+       # versions of the package.
+       tag 'remove-of-unknown-diversion', $divert, "$file:$line";
+    }
+}
+
 for my $file (grep { defined $added_diversions{$_} } keys %added_diversions) {
     tag 'orphaned-diversion', $file, $added_diversions{$file};
 }

Regards,

Adam



Reply to: