On Thu, 17 Aug 2023 13:01:43 +0200 Philipp Huebner <[email protected]>
wrote:
> FWIW, I can reproduce and thus confirm this.

This issue - that the error code is 2 when --show-overrides is used and 0
otherwise is also reproduced in

https://salsa.debian.org/emacsen-team/dh-make-elpa/-/commits/debian/0.19.2?ref_type=tags


I believe the issue is in Pool.pm on lines 173 to 212 - and specifically
line 194 (
https://salsa.debian.org/rpil2/lintian/-/blob/master/lib/Lintian/Pool.pm#L173-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)


But on line 194, if an 'error' tag is overridden and --show-overrides is
present, the block
does not to call 'next' (because it needs to "keep" the hint, to show the
"O:" line - but keeping
does not happen until line 211).

But then line 197 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 MR thttps://salsa.debian.org/lintian/lintian/-/merge_requests/485
fixes it (i hope!):

It changes line 197 to only run the sub-block that "counts" the number of
errors if an override was not defined.

In the MR, the first non-trivial commit adds a test that triggers the bug:
the autopkgtests fail the next commit then fixes the bug: the tests now all
pass

(see https://salsa.debian.org/rpil2/lintian/-/commits/fix-show-overrides)

(incidentally there seem to be two descriptions of the test suite in
CONTRIBUTING.md and t/recipes/README --  neither seems to be correct:
* they talk about a script in private to build the packages to be tested
but that script doesn't seem to exist. --  i think you are meant to run
'private/runtests' to build all (?) the test packages, and only then will
runtests --run-only work (??)
* the Options: line in desc may not be correct - a load of other options
seem to be set as well, but i couldn't work out how to fix this

(I think i've worked out some of it: to make a test it seems you need :
* a new dir in t/recipes
- build-spec dir which defines a package to run lintian on via:
  + a debian/ dir which overrides the template
  + an orig/ dir for upstream files (even for testing a native)
  + a fill-values file that says what template to use
- an eval dir which defines the expected output (in literal) and command
line (in desc) --- the documentation is really confusing on the fields
needed here, especially the "Check" field and Output-Format - both seem
crucial-- i have mostly inferred these from what other tests do. )

both desc and fill-values need a matching Testname which also needs to
match the directory name (but why isnt this just inferred??)

you need most of the packages in debian/tests/control installed, plus git

then run private/runtests to build packages
- this can silently fail if you didn't install the right packages
- the working directory probably needs to be the parent of private
- can then use runtests with the --run-only=test:X option where X matches
Testname. (this doesn't (always?) rebuild the package)

the package is built in somewhere under debian/test-out/ with a dir for
each test - the file called "log" says exactly what lintian command was run
in the test which is really helpful in understanding the above). You can
force packages to be rebuilt with "git clean -C -f"
)

Reply via email to