action #90371
closedWarnings "Subroutine JSON::PP::Boolean::(0+ redefined"
Description
Currently the openQA fullstack tests show these warnings:
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(++ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(++ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(-- redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
https://app.circleci.com/pipelines/github/os-autoinst/openQA/5998/workflows/94c76040-f055-4899-8372-bd5d3f416a50/jobs/56590
https://app.circleci.com/pipelines/github/os-autoinst/openQA/5998/workflows/94c76040-f055-4899-8372-bd5d3f416a50/jobs/56591
The reason seems to be that Cpanel::JSON::XS creates the JSON::PP::Boolean namespace and overloads without using the module. Then when JSON::PP is used, perl sees that the overloads have already been defined.
https://github.com/rurban/Cpanel-JSON-XS/issues/65
perl -wE 'use Cpanel::JSON::XS (); use JSON::PP ()'
Subroutine JSON::PP::Boolean::(++ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(0+ redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
Subroutine JSON::PP::Boolean::(-- redefined at /usr/lib/perl5/5.26.1/overload.pm line 48.
The reason in our case seems to be the following:
- It only happens with Devel::Cover
- Devel::Cover uses JSON::MaybeXS (which then uses Cpanel::JSON::XS)
- Some other code in our code base or in CPAN modules used by us is using JSON::PP
Updated by tinita over 3 years ago
- Related to action #72082: Reduce test runtime, e.g. less reliance on test fixtures or test database instances added
Updated by tinita over 3 years ago
- Related to action #38264: os-autoinst-distri-opensuse self-tests fail in travis CI with "Subroutine JSON::PP::Boolean::(0+ redefined" but not locally added
Updated by tinita over 3 years ago
- Related to action #29048: perl warning about "Subroutine JSON::PP::Boolean::(0+ redefined" on manual startup of openqa-scheduler added
Updated by tinita over 3 years ago
A quick "fix" can be to use JSON::PP before everything else in the Makefile when using Devel::Cover:
COVEROPT ?= -MJSON::PP -MDevel::Cover=-select_re
The fact that these warnings only appear in fullstack tests suggest, that in os-autoinst code we are using JSON::PP somewhere (directly or indirectly via CPAN modules) after Devel::Cover loads Cpanel::JSON::XS, and in openQA we either never use JSON::PP, or it is used before Devel::Cover loads Cpanel::JSON::XS. I don't know yet at which point Devel::Cover loads the module.
The warning is harmless, but annoying and distracting from potentially less harmless warnings.
Updated by tinita over 3 years ago
Another question would be why Test::Warnings doesn't catch that. No idea so far.
Updated by livdywan over 3 years ago
tinita wrote:
A quick "fix" can be to use JSON::PP before everything else in the Makefile when using Devel::Cover:
export PERL5OPT="-MJSON::PP -MDevel::Cover...
Assuming we only need this when we collect coverage, COVEROPT
could be used (this gets added to PERL5OPT then), which is where we add Cover as well.
Updated by tinita over 3 years ago
yeah, I actually meant COVEROPT, this was a copy&paste mistake.
Updated by tinita over 3 years ago
- Status changed from New to In Progress
- Assignee set to tinita
- Target version changed from future to Ready
Updated by tinita over 3 years ago
Updated by tinita over 2 years ago
- Status changed from Resolved to Feedback
We also have the problem in isotovideo during tests.
PR: https://github.com/os-autoinst/os-autoinst/pull/2005
Newer versions of JSON::PP avoid the warnings, so I think with the next perl version this could be fixed.