Bug#1037453: libmail-dmarc-perl: FTBFS with test failures when there's no network

2023-06-15 Thread Noah Meyerhans

Control: tags -1 + pending


On 6/12/2023 8:58 PM, Steve Langasek wrote:

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. It seems to build in a completely disconnected environment with 
your patch applied, so let's start with it.




Bug#1037453: libmail-dmarc-perl: FTBFS with test failures when there's no network

2023-06-12 Thread Steve Langasek
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.0 -0800
+++ libmail-dmarc-perl-1.20211209/debian/patches/series 2023-06-12 
18:30:18.0 -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.0 -0800
+++ libmail-dmarc-perl-1.20211209/debian/patches/skip_network_tests.patch   
2023-06-12 18:43:32.0 -0700
@@ -0,0 +1,127 @@
+Description: skip tests that depend on network access
+Author: Steve Langasek 
+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";
+-