commit:     8146f7e4bb0353f76767e8a8bab0a403e3e3233c
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  2 14:04:40 2016 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 14:04:52 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8146f7e4

dev-perl/Plack: Fence out network IO re bug #527362

Under EAPI6, NO_NETWORK_TESTING is exported by default
and these tests will be skipped regardless.

They can be turned back on, but you'll have to read the eclass source.

Thanks to  Diego Elio Pettenò for reporting.

Bug: https://bugs.gentoo.org/527362

Package-Manager: portage-2.3.0
RepoMan-Options: --include-arches="alpha amd64 amd64-fbsd arm arm64 hppa ia64 
m68k mips nios2 ppc ppc64 riscv s390 sh sparc sparc-fbsd x86 x86-fbsd"

 dev-perl/Plack/Plack-1.3.900.ebuild                |   1 +
 .../files/Plack-1.3.900-network-testing.patch      | 196 +++++++++++++++++++++
 2 files changed, 197 insertions(+)

diff --git a/dev-perl/Plack/Plack-1.3.900.ebuild 
b/dev-perl/Plack/Plack-1.3.900.ebuild
index 1acafb0..6ab5f7a 100644
--- a/dev-perl/Plack/Plack-1.3.900.ebuild
+++ b/dev-perl/Plack/Plack-1.3.900.ebuild
@@ -15,6 +15,7 @@ KEYWORDS="~amd64 ~x86"
 IUSE="test minimal examples"
 PATCHES=(
        "${FILESDIR}/${P}-issue-545.patch"
+       "${FILESDIR}/${P}-network-testing.patch"
 )
 RDEPEND="
        !minimal? (

diff --git a/dev-perl/Plack/files/Plack-1.3.900-network-testing.patch 
b/dev-perl/Plack/files/Plack-1.3.900-network-testing.patch
new file mode 100644
index 0000000..6d703a9
--- /dev/null
+++ b/dev-perl/Plack/files/Plack-1.3.900-network-testing.patch
@@ -0,0 +1,196 @@
+From 5f5a0a34556d0ae739f79d7c148d24fcf3ff8557 Mon Sep 17 00:00:00 2001
+From: Kent Fredric <kentfred...@gmail.com>
+Date: Wed, 3 Aug 2016 01:26:17 +1200
+Subject: [PATCH] Fence of Network IO with NO_NETWORK_TESTING
+
+This is a workaround for #477 but doesn't actually fix the underlying
+issue, merely recognises that some vendors are smart enough to
+anticipate Network IO will fail and integrate this ENV var to quickly
+avoid it.
+
+This precedent was established by Test::RequiresInternet as a result of
+a CPANworkers discussion, and Gentoo is known to export this variable
+within its tooling by default as a result.
+
+This doesn't actually test that binding a socket/IP will work, but this
+fence should be tested anyway, because security measures could result in
+attempted socket/IP binds getting SIGKILLed ( Sandbox )
+
+This commit hence addresses/fences only the problem cases listed in bug
+in depth.
+
+However, this commit targets to simply solve the known parts of the
+problem in the simplest way possible without any extra dependencies.
+
+The application of a BEGIN { } block and `print` was a design decision
+instead of using `Test::More` and `skip`, because the overhead of
+loading Test::More is quite high when you have lots of .t files, and
+Test2 further increases the load time.
+
+This load time is generally acceptable if you're actually running a
+dozen tests, but spinning up a full suite of Test::More to only then
+immediately exit with a skip is a lot of CPU load for relatively little
+benefit.
+---
+ t/Plack-Handler/standalone.t                      | 6 ++++++
+ t/Plack-Loader/shotgun.t                          | 6 ++++++
+ t/Plack-Middleware/component-leak.t               | 7 +++++++
+ t/Plack-Middleware/error_document_streaming_app.t | 7 +++++++
+ t/Plack-Middleware/stacktrace/sigdie.t            | 7 +++++++
+ t/Plack-Middleware/stacktrace/utf8.t              | 7 +++++++
+ t/Plack-Middleware/urlmap_ports.t                 | 6 ++++++
+ t/Plack-Test/2args.t                              | 7 +++++++
+ t/Plack-Test/hello_server.t                       | 7 +++++++
+ t/Plack-Util/response_cb.t                        | 7 +++++++
+ 10 files changed, 67 insertions(+)
+
+diff --git a/t/Plack-Handler/standalone.t b/t/Plack-Handler/standalone.t
+index f5fcf26..b42de16 100644
+--- a/t/Plack-Handler/standalone.t
++++ b/t/Plack-Handler/standalone.t
+@@ -1,3 +1,9 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
+ use strict;
+ use warnings;
+ use Test::More;
+diff --git a/t/Plack-Loader/shotgun.t b/t/Plack-Loader/shotgun.t
+index cb7b95a..d9fe148 100644
+--- a/t/Plack-Loader/shotgun.t
++++ b/t/Plack-Loader/shotgun.t
+@@ -1,3 +1,9 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
+ use strict;
+ use warnings;
+ use Test::More;
+diff --git a/t/Plack-Middleware/component-leak.t 
b/t/Plack-Middleware/component-leak.t
+index 7cdab99..2acedd0 100644
+--- a/t/Plack-Middleware/component-leak.t
++++ b/t/Plack-Middleware/component-leak.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ package MyComponent;
+ use strict;
+ use warnings;
+diff --git a/t/Plack-Middleware/error_document_streaming_app.t 
b/t/Plack-Middleware/error_document_streaming_app.t
+index b177c53..c893e7b 100644
+--- a/t/Plack-Middleware/error_document_streaming_app.t
++++ b/t/Plack-Middleware/error_document_streaming_app.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ use strict;
+ use warnings;
+ use FindBin;
+diff --git a/t/Plack-Middleware/stacktrace/sigdie.t 
b/t/Plack-Middleware/stacktrace/sigdie.t
+index dc82b2c..28747cf 100644
+--- a/t/Plack-Middleware/stacktrace/sigdie.t
++++ b/t/Plack-Middleware/stacktrace/sigdie.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ use strict;
+ use warnings;
+ use Test::More;
+diff --git a/t/Plack-Middleware/stacktrace/utf8.t 
b/t/Plack-Middleware/stacktrace/utf8.t
+index 6d2f51f..77849dc 100644
+--- a/t/Plack-Middleware/stacktrace/utf8.t
++++ b/t/Plack-Middleware/stacktrace/utf8.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ use strict;
+ use warnings;
+ use Test::More;
+diff --git a/t/Plack-Middleware/urlmap_ports.t 
b/t/Plack-Middleware/urlmap_ports.t
+index 9a0a9c0..4ff4ba5 100644
+--- a/t/Plack-Middleware/urlmap_ports.t
++++ b/t/Plack-Middleware/urlmap_ports.t
+@@ -1,3 +1,9 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
+ use strict;
+ use Test::More;
+ use Plack::App::URLMap;
+diff --git a/t/Plack-Test/2args.t b/t/Plack-Test/2args.t
+index 2942f93..a68481d 100644
+--- a/t/Plack-Test/2args.t
++++ b/t/Plack-Test/2args.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ use Plack::Test;
+ use Test::More;
+ use HTTP::Request::Common;
+diff --git a/t/Plack-Test/hello_server.t b/t/Plack-Test/hello_server.t
+index 47ffb75..dc9f4bd 100644
+--- a/t/Plack-Test/hello_server.t
++++ b/t/Plack-Test/hello_server.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ use Test::More;
+ use Plack::Test;
+ 
+diff --git a/t/Plack-Util/response_cb.t b/t/Plack-Util/response_cb.t
+index 813dc87..5cb31ba 100644
+--- a/t/Plack-Util/response_cb.t
++++ b/t/Plack-Util/response_cb.t
+@@ -1,3 +1,10 @@
++BEGIN {
++  if ( $ENV{NO_NETWORK_TESTING} ) {
++    print '1..0 # SKIP Network connections required for this test';
++    exit;
++  }
++}
++
+ use strict;
+ use warnings;
+ use Plack::Util;
+-- 
+2.9.2
+

Reply via email to