Axel Beckert pushed to branch master at lintian / lintian


Commits:
5bffcd9a by Richard Lewis at 2024-02-05T00:50:58+00:00
Add *~ to .gitignore

- - - - -
40f26ce4 by Richard Lewis at 2024-02-05T00:50:58+00:00
Add test that demonstrates bug #1019690

lintian exits with code 2 when --show-overrides is given and an error is fixed.
The test added will fail: the next commit will fix lintian so it passes.

- - - - -
372ac9c8 by Richard Lewis at 2024-02-05T00:50:58+00:00
Fix exit code when --show-overrides is given and an 'error' tag is 
overridden

Previously, if an error tag was overridden but --show-overrides was given,
lintian would correctly override the tag, but incorrectly give an exit
code of 2.

The reason is a logic error in lib/Lintian/Pool.pm in the code from lines 
173-212

The whole block seems to be attempting to:
- skip hints (tags) that should not be displayed (experimental, or at a too-low 
display-level)
- count number of errors/warnings that remain (used in line 217 to set exit 
code)
- keep hints that should be displayed (line 211)

Because on line 194, if an 'error' tag is overridden and 
--show-overrides is given the block
decided not to call next (because keeping the hint doesnt happen until line 
211).

But then line 197 is executed which means that the hint is counted as a 
warning/error/etc whenever
show-overrides was present: effectively show-overrides makes it look like no 
override was present.

(And then on line 217 the exit_code will be set to 2).

This patch therefore changes 197 to only run the sub-block if an override was 
not defined.

- - - - -


8 changed files:

- .gitignore
- lib/Lintian/Pool.pm
- + 
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/debian/install
- + 
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/debian/lintian-overrides
- + 
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/fill-values
- + 
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/orig/file
- + t/recipes/lintian-features/exit-status/show-overrides-exit-status/eval/desc
- + 
t/recipes/lintian-features/exit-status/show-overrides-exit-status/eval/literal


Changes:

=====================================
.gitignore
=====================================
@@ -17,6 +17,7 @@
 /.idea/
 /.nobackup
 *.bak
+*~
 *.rej
 cover_db*
 /coverage-report


=====================================
lib/Lintian/Pool.pm
=====================================
@@ -191,8 +191,7 @@ sub process{
                 next
                   unless $PROFILE->display_level_for_tag($hint->tag_name);
 
-                if (!defined $hint->override
-                    || $option->{'show-overrides'}) {
+                if (!defined $hint->override) {
 
                     ++$reported_count{$tag->visibility}
                       if !$tag->experimental;


=====================================
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/debian/install
=====================================
@@ -0,0 +1 @@
+file /usr/share/file


=====================================
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/debian/lintian-overrides
=====================================
@@ -0,0 +1,2 @@
+# package installs a d/rules template not a script
+missing-dep-for-interpreter /usr/bin/make *


=====================================
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/fill-values
=====================================
@@ -0,0 +1,3 @@
+Skeleton: upload-native
+Testname: show-overrides-exit-status
+Description: Bug #1019690 correct exit status when show-overrides


=====================================
t/recipes/lintian-features/exit-status/show-overrides-exit-status/build-spec/orig/file
=====================================
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+       dh $@ --with elpa


=====================================
t/recipes/lintian-features/exit-status/show-overrides-exit-status/eval/desc
=====================================
@@ -0,0 +1,6 @@
+Testname: show-overrides-exit-status
+Check: scripts
+Exit-Status: 0
+Match-Strategy: literal
+Output-Format: EWI
+Default-Lintian-Options: --show-overrides --fail-on error


=====================================
t/recipes/lintian-features/exit-status/show-overrides-exit-status/eval/literal
=====================================
@@ -0,0 +1,2 @@
+N: package installs a d/rules template not a script
+O: show-overrides-exit-status: missing-dep-for-interpreter /usr/bin/make (does 
not satisfy make:any | build-essential:any | dpkg-dev:any) [usr/share/file/file]



View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/151989ab43db9082c02a75e5d3683fe0bbd6c4cc...372ac9c821c29df356378c9ec3f66dd7cefb94ce

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/151989ab43db9082c02a75e5d3683fe0bbd6c4cc...372ac9c821c29df356378c9ec3f66dd7cefb94ce
You're receiving this email because of your account on salsa.debian.org.


Reply via email to