Felix Lechner pushed to branch master at lintian / lintian


Commits:
53f02436 by Felix Lechner at 2022-01-19T11:55:43-08:00
Prevent issuance of tags under their old names.

Julian Gilbey was able to spot [1] a super obscure bug introduced recently when
the handling of tags was revamped so that old tag names could be shown on the
website along with their current names.

[1] 
https://salsa.debian.org/lintian/lintian/-/commit/5e20ecb49725912c7d7a42a721a38987981fd0dd#note_291378

The bug was probably introduced in commit 3ad636e37a1.

Lintian now complains, as it should, about the old tag names being issued with
the two warnings below. This commit also fixes those warnings.

Warning in processable [...]/requests-undeclared-python-versions_1.0.dsc:
 Tried to issue renamed tag declare-requested-python-versions-for-test
 (current name declare-python-versions-for-test)
 in check testsuite. at [...]/lib/Lintian/Group.pm line 333.

Warning in processable [...]/does-not-query-declared-python-versions_1.0.dsc:
 Tried to issue renamed tag query-requested-python-versions-in-test
 (current name query-declared-python-versions-in-test)
 in check testsuite. at [...]/lib/Lintian/Group.pm line 333.

Thanks to Julian for his extraordinary attention!

Gbp-Dch: ignore

- - - - -


3 changed files:

- lib/Lintian/Check/Testsuite.pm
- lib/Lintian/Group.pm
- tags/q/query-declared-python-versions-in-test.tag


Changes:

=====================================
lib/Lintian/Check/Testsuite.pm
=====================================
@@ -309,13 +309,13 @@ sub check_test_file {
 
             my $debian_control = $self->processable->debian_control;
 
-            $self->pointed_hint('declare-requested-python-versions-for-test',
+            $self->pointed_hint('declare-python-versions-for-test',
                 $pointer, $command)
               if $options =~ m{ \s (?: -\w*r | --requested ) }x
               && !$debian_control->source_fields->declares(
                 'X-Python3-Version');
 
-            $self->pointed_hint('query-requested-python-versions-in-test',
+            $self->pointed_hint('query-declared-python-versions-in-test',
                 $pointer,
                 $debian_control->source_fields->value('X-Python3-Version'))
               if $options =~ m{ \s (?: -\w*s | --supported ) }x


=====================================
lib/Lintian/Group.pm
=====================================
@@ -304,39 +304,50 @@ sub process {
 
         for my $hint (@from_checks) {
 
-            my $tag_name = $hint->tag_name;
+            my $as_issued = $hint->tag_name;
 
             croak encode_utf8('No tag name')
-              unless length $tag_name;
+              unless length $as_issued;
 
             my $issuer = $hint->issued_by;
 
             # try local name space
-            my $tag = $self->profile->get_tag("$issuer/$tag_name");
+            my $tag = $self->profile->get_tag("$issuer/$as_issued");
 
             warn encode_utf8(
-"Using tag $tag_name as name spaced while not so declared (in check $issuer)."
+"Using tag $as_issued as name spaced while not so declared (in check $issuer)."
             )if defined $tag && !$tag->name_spaced;
 
             # try global name space
-            $tag ||= $self->profile->get_tag($tag_name);
+            $tag ||= $self->profile->get_tag($as_issued);
 
             unless (defined $tag) {
                 warn encode_utf8(
-                    "Tried to issue unknown tag $tag_name in check $issuer.");
+                    "Tried to issue unknown tag $as_issued in check $issuer.");
+                next;
+            }
+
+            if (  !$tag->name_spaced && $tag->name ne $as_issued
+                || $tag->name_spaced && $tag->name ne "$issuer/$as_issued") {
+
+                my $current_name = $tag->name;
+                warn encode_utf8(
+"Tried to issue renamed tag $as_issued (current name $current_name) in check 
$issuer."
+                );
+
                 next;
             }
 
             my $owner = $tag->check;
             if ($issuer ne $owner) {
                 warn encode_utf8(
-                    "Check $issuer has no tag $tag_name (but $owner does).");
+                    "Check $issuer has no tag $as_issued (but $owner does).");
                 next;
             }
 
             # pull name from tag; could be name-spaced
             $hint->tag_name($tag->name);
-            $tag_name = $hint->tag_name;
+            my $tag_name = $hint->tag_name;
 
             # skip disabled tags
             next


=====================================
tags/q/query-declared-python-versions-in-test.tag
=====================================
@@ -1,4 +1,4 @@
-Tag:  query-declared-python-versions-in-test
+Tag: query-declared-python-versions-in-test
 Severity: warning
 Check: testsuite
 Renamed-From:



View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/commit/53f0243677be9b1e3ad25157d5db8402479ae074

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/commit/53f0243677be9b1e3ad25157d5db8402479ae074
You're receiving this email because of your account on salsa.debian.org.


Reply via email to