Project

General

Profile

action #90371

Warnings "Subroutine JSON::PP::Boolean::(0+ redefined"

Added by tinita 7 months ago. Updated 7 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Concrete Bugs
Target version:
Start date:
2021-03-19
Due date:
% Done:

0%

Estimated time:
Difficulty:

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

Related issues

Related to openQA Project - action #72082: Reduce test runtime, e.g. less reliance on test fixtures or test database instancesResolved2020-09-18

Related to openQA Tests - action #38264: os-autoinst-distri-opensuse self-tests fail in travis CI with "Subroutine JSON::PP::Boolean::(0+ redefined" but not locallyResolved2018-07-06

Related to openQA Project - action #29048: perl warning about "Subroutine JSON::PP::Boolean::(0+ redefined" on manual startup of openqa-schedulerResolved2017-12-07

History

#1 Updated by tinita 7 months ago

  • Related to action #72082: Reduce test runtime, e.g. less reliance on test fixtures or test database instances added

#2 Updated by tinita 7 months 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

#3 Updated by tinita 7 months ago

  • Related to action #29048: perl warning about "Subroutine JSON::PP::Boolean::(0+ redefined" on manual startup of openqa-scheduler added

#4 Updated by tinita 7 months 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.

#5 Updated by tinita 7 months ago

Another question would be why Test::Warnings doesn't catch that. No idea so far.

#6 Updated by cdywan 7 months 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.

#7 Updated by tinita 7 months ago

yeah, I actually meant COVEROPT, this was a copy&paste mistake.

#8 Updated by tinita 7 months ago

  • Status changed from New to In Progress
  • Assignee set to tinita
  • Target version changed from future to Ready

#10 Updated by tinita 7 months ago

  • Status changed from In Progress to Feedback

#11 Updated by tinita 7 months ago

  • Status changed from Feedback to Resolved

PR was merged

Also available in: Atom PDF