Package: libmail-dmarc-perl
Version: 1.20211209-4
Severity: serious
Tags: patch
Justification: Policy 4.9
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu mantic ubuntu-patch

Hi Noah,

libmail-dmarc-perl has yet to be included in an Ubuntu release because its
build-time tests depend on network access.  This is a fairly reasonable
thing to want to do in this package, to validate real-world DNS entries. 
However, it falls afoul of Launchpad's network policy, and is also AIUI a
violation of Policy 4.9.  It also represents an external dependency for the
package, which can result in regressions in buildability if in the future
the referenced domains change their DNS settings.

I've applied the attached (very dirty) patch to libmail-dmarc-perl in
Ubuntu, which is sufficient to let the package build in Launchpad.  Having
looked at some of the surrounding tests, I'm not sure this would let the
package build in a completely offline environment - I think Launchpad
provides name resolution of a limited subset of domains, so some tests which
pass in Launchpad may also fail when offline.

Thanks for considering,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru libmail-dmarc-perl-1.20211209/debian/patches/series 
libmail-dmarc-perl-1.20211209/debian/patches/series
--- libmail-dmarc-perl-1.20211209/debian/patches/series 2023-01-28 
20:45:01.000000000 -0800
+++ libmail-dmarc-perl-1.20211209/debian/patches/series 2023-06-12 
18:30:18.000000000 -0700
@@ -1,2 +1,3 @@
 0001-pod-Fix-missing-and-malformed-NAME-headings.patch
 0005-recommend-system-psl.patch
+skip_network_tests.patch
diff -Nru libmail-dmarc-perl-1.20211209/debian/patches/skip_network_tests.patch 
libmail-dmarc-perl-1.20211209/debian/patches/skip_network_tests.patch
--- libmail-dmarc-perl-1.20211209/debian/patches/skip_network_tests.patch       
1969-12-31 16:00:00.000000000 -0800
+++ libmail-dmarc-perl-1.20211209/debian/patches/skip_network_tests.patch       
2023-06-12 18:43:32.000000000 -0700
@@ -0,0 +1,127 @@
+Description: skip tests that depend on network access
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2023606
+Last-Update: 2023-06-12
+Forwarded: no
+
+Index: libmail-dmarc-perl-1.20211209/t/04.PurePerl.t
+===================================================================
+--- libmail-dmarc-perl-1.20211209.orig/t/04.PurePerl.t
++++ libmail-dmarc-perl-1.20211209/t/04.PurePerl.t
+@@ -31,20 +31,20 @@
+ isa_ok( $dmarc, 'Mail::DMARC::PurePerl' );
+ 
+ test_get_from_dom();
+-test_fetch_dmarc_record();
++#test_fetch_dmarc_record();
+ test_get_organizational_domain();
+-test_exists_in_dns();
++#test_exists_in_dns();
+ test_is_spf_aligned();
+ test_is_dkim_aligned();
+ test_is_aligned();
+ test_is_whitelisted();
+-test_discover_policy();
++#test_discover_policy();
+ test_validate();
+-test_has_valid_reporting_uri();
++#test_has_valid_reporting_uri();
+ test_external_report();
+-test_verify_external_reporting( 'tnpi.net',            'theartfarm.com', 1 );
+-test_verify_external_reporting( 'cadillac.net',        'theartfarm.com', 1 );
+-test_verify_external_reporting( 'mail-dmarc.tnpi.net', 'theartfarm.com', 1 );
++#test_verify_external_reporting( 'tnpi.net',            'theartfarm.com', 1 );
++#test_verify_external_reporting( 'cadillac.net',        'theartfarm.com', 1 );
++#test_verify_external_reporting( 'mail-dmarc.tnpi.net', 'theartfarm.com', 1 );
+ _test_reason();
+ 
+ done_testing();
+@@ -77,11 +77,8 @@
+         ]);
+ 
+     my $policy = $dmarc->discover_policy;
+-    ok( $policy, "discover_policy" );
+     my $result = $dmarc->validate($policy);
+     ok( ref $result, "result is a ref");
+-    ok( $result->{result} eq 'pass', "result=pass");
+-    ok( $result->{spf} eq 'pass', "spf=pass");
+     ok( $result->{disposition} eq 'none', "disposition=none");
+ 
+     $result->disposition('reject');
+@@ -91,7 +88,6 @@
+     ok( $result->reason( type => 'local_policy', comment => 'testing' ), 
"added reason 2" );
+     #warn Data::Dumper::Dumper($result->reason);
+ 
+-    ok( $dmarc->save_aggregate(), "save aggregate");
+ }
+ 
+ sub test_verify_external_reporting {
+Index: libmail-dmarc-perl-1.20211209/t/06.Result.t
+===================================================================
+--- libmail-dmarc-perl-1.20211209.orig/t/06.Result.t
++++ libmail-dmarc-perl-1.20211209/t/06.Result.t
+@@ -17,7 +17,7 @@
+ isa_ok( $result, 'Mail::DMARC::Result' );
+ 
+ my $test_dom = 'tnpi.net';
+-test_published();
++#test_published();
+ test_no_policy();
+ test_disposition();
+ test_dkim();
+@@ -203,9 +203,7 @@
+     $pp->validate();
+ 
+     my $skip_reason;
+-    if ( !$pp->result->reason ) {    # typically a DNS failure,
+-        $skip_reason = "look like DNS is not working";
+-    };
++    $skip_reason = "look like DNS is not working";
+ 
+ SKIP: {
+         skip $skip_reason, 1 if $skip_reason;
+Index: libmail-dmarc-perl-1.20211209/t/22.Report.Send.SMTP.t
+===================================================================
+--- libmail-dmarc-perl-1.20211209.orig/t/22.Report.Send.SMTP.t
++++ libmail-dmarc-perl-1.20211209/t/22.Report.Send.SMTP.t
+@@ -34,8 +34,8 @@
+ $agg->metadata->report_id( '2013.06.01.6789' );
+ 
+ test_get_subject();
+-test_get_domain_mx();
+-test_get_smtp_hosts();
++#test_get_domain_mx();
++#test_get_smtp_hosts();
+ test_human_summary();
+ test_get_filename();
+ test_get_timestamp_rfc2822();
+Index: libmail-dmarc-perl-1.20211209/t/26.Report.Sender.t
+===================================================================
+--- libmail-dmarc-perl-1.20211209.orig/t/26.Report.Sender.t
++++ libmail-dmarc-perl-1.20211209/t/26.Report.Sender.t
+@@ -110,12 +110,7 @@
+             is( scalar @deliveries, 0, 'Email send fails' );
+         }
+         else {
+-            is( scalar @deliveries, 1, '1 Email sent' );
+-            is( $deliveries[0]->{envelope}->{to}->[0], 
'r...@fastmaildmarc.com', 'Sent to correct address' );
+-            my $body = ${$deliveries[0]->{email}->[0]->{body}};
+-            is( $body =~ /This is a DMARC aggregate report for 
fastmaildmarc.com/, 1, 'Human readable description' );
+-            is( $body =~ /1 records.\n0 passed.\n1 failed./, 1, 'Human 
readable summary');
+-            is( $body =~ /Content-Type: application\/gzip/, 1, 'Gzip 
attachment' );
++            is( 1, 1, 'Mock up test (network tests skipped)' );
+         }
+     };
+ 
+Index: libmail-dmarc-perl-1.20211209/t/11.Report.Store.t
+===================================================================
+--- libmail-dmarc-perl-1.20211209.orig/t/11.Report.Store.t
++++ libmail-dmarc-perl-1.20211209/t/11.Report.Store.t
+@@ -49,6 +49,7 @@
+     $dmarc->dkim([ { domain => $test_dom, result => 'pass', selector => 
'apr2013' } ]);
+     $dmarc->spf({ domain => $test_dom, scope => 'mfrom', result => 'pass' } );
+     $dmarc->validate() or diag Dumper($dmarc) and return;
++    return 1;
+     my $pub = delete $dmarc->result->{published};
+     ok( $pub, "pub" );
+     is_deeply(

Reply via email to