Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test::Reporter::read() fails to overwrite 'osvers' #6

Open
andk opened this issue Mar 15, 2022 · 0 comments
Open

Test::Reporter::read() fails to overwrite 'osvers' #6

andk opened this issue Mar 15, 2022 · 0 comments

Comments

@andk
Copy link

andk commented Mar 15, 2022

When Test::Reporter sends a report from a file that a different perl had previously written, then the object that gets posted to metabase contains the field 'osvers' of the running perl instead of the one of the perl that wrote the report.

I have patched Test::Reporter with this change:

--- /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.30.1/1e0c/lib/site_perl/5.30.1/Test/Reporter.pm~1.62  2015-04-06 16:02:27.000000000 +0000
+++ /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.30.1/1e0c/lib/site_perl/5.30.1/Test/Reporter.pm       2022-03-15 03:22:29.294638925 +0000
@@ -3,7 +3,7 @@
 use warnings;
 package Test::Reporter;
 
-our $VERSION = '1.62';
+our $VERSION = '1.620001';
 
 use Cwd;
 use Config;
@@ -368,10 +368,11 @@
           $self->{_from} = $content;
         } elsif ($header eq "Subject") {
           $self->{_subject} = $content;
-          my ($grade, $distribution, $archname) = (split /\s/, $content)[0..2];
+          my ($grade, $distribution, $archname, $osvers) = (split /\s/, $content)[0..3];
           $self->{_grade} = lc $grade;
           $self->{_distribution} = $distribution;
           $self->{_perl_version}{_archname} = $archname;
+          $self->{_perl_version}{_osvers} = $osvers;
           $self->{_subject_lock} = 1;
         } elsif ($header eq "X-Test-Reporter-Distfile") {
           $self->{_distfile} = $content;

As a verification that it works, witness these two queries to the API:

A report before the patch: curl -X GET --header 'Accept: text/html' 'http://api.cpantesters.org/v3/report/6aaa81be-a40e-11ec-8b43-57cb0b534052'
In the output you find osvers=5.4.0-100-generic in the report and "osversion":"5.3.0-2-amd64" as object attribute. These two things should be the same, but here the second one comes from the perl that delivered the report to the API.

A report after my patch: curl -X GET --header 'Accept: text/html' 'http://api.cpantesters.org/v3/report/b08fa7c6-a40f-11ec-bf89-e2e80b534052'
In this output you find osvers=4.15.0-169-generic in the report and "osversion":"4.15.0-169-generic" as object attribute. Here the two strings are identical, osvers does not "leak" from the delivering perl to the delivered report.

I hope you like it,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant