[DRE-maint] Bug#893447: nanoc: autopkgtest fails with local firewall

Steve Langasek steve.langasek at canonical.com
Sun Mar 18 22:52:29 UTC 2018


Package: nanoc
Version: 4.8.10-1
Severity: minor
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch autopkgtest

Dear Cédric,

In Ubuntu, the nanoc autopkgtests have been failing, which is a blocker for
inclusion of the new version in the upcoming Ubuntu release:

  1) Nanoc::CLI::Commands::View#run does not listen on non-local interfaces
     Failure/Error: expect { Net::HTTP.get(non_local_addresses[0], '/', 50_385) 
}.to raise_error(Errno::ECONNREFUSED)

       expected Errno::ECONNREFUSED, got #<Net::ReadTimeout: Net::ReadTimeout> w
ith backtrace:
         # ./spec/nanoc/cli/commands/view_spec.rb:71:in `block (5 levels) in <to
p (required)>'
         # ./spec/nanoc/cli/commands/view_spec.rb:71:in `block (4 levels) in <to
p (required)>'
         # ./spec/nanoc/cli/commands/view_spec.rb:21:in `run_nanoc_cmd'
         # ./spec/nanoc/cli/commands/view_spec.rb:70:in `block (3 levels) in <to
p (required)>'
         # ./spec/spec_helper.rb:52:in `block (2 levels) in <top (required)>'
         # ./spec/spec_helper.rb:30:in `block (4 levels) in <top (required)>'
         # ./spec/spec_helper.rb:30:in `block (3 levels) in <top (required)>'
         # ./spec/spec_helper.rb:29:in `block (2 levels) in <top (required)>'
         # ./spec/spec_helper.rb:24:in `block (2 levels) in <top (required)>'
     # ./spec/nanoc/cli/commands/view_spec.rb:71:in `block (4 levels) in <top (r
equired)>'
     # ./spec/nanoc/cli/commands/view_spec.rb:21:in `run_nanoc_cmd'
     # ./spec/nanoc/cli/commands/view_spec.rb:70:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:52:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:30:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:30:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:29:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:24:in `block (2 levels) in <top (required)>'

Progress: |====================================================================|

Finished in 2 minutes 26.6 seconds (files took 1.86 seconds to load)
2228 examples, 1 failure

  http://autopkgtest.ubuntu.com/packages/n/nanoc/bionic/amd64

This test assumes that an attempt to connect to the port will fail with
ECONNREFUSED, but on a system with a firewall it may instead fail with a
timeout.  So even though the test passes fine in Debian, I think the test is
buggy.

I have uploaded the attached patch to Ubuntu to fix this test failure. 
Please consider applying a change like this in Debian as well.

(Of course, even with the test fixed, nanoc will be blocked from inclusion
in the next release until Debian bug #892195 is also fixed, solving the
build failure against ruby2.5.)

Thanks,
-- 
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                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru nanoc-4.8.10/debian/patches/series nanoc-4.8.10/debian/patches/series
--- nanoc-4.8.10/debian/patches/series	2017-10-17 12:49:22.000000000 -0700
+++ nanoc-4.8.10/debian/patches/series	2018-03-18 15:43:14.000000000 -0700
@@ -7,3 +7,4 @@
 encoding.patch
 skip_tests_autopkgtest.patch
 no_simplecov.patch
+skip-network-test.patch
diff -Nru nanoc-4.8.10/debian/patches/skip-network-test.patch nanoc-4.8.10/debian/patches/skip-network-test.patch
--- nanoc-4.8.10/debian/patches/skip-network-test.patch	1969-12-31 16:00:00.000000000 -0800
+++ nanoc-4.8.10/debian/patches/skip-network-test.patch	2018-03-18 15:46:49.000000000 -0700
@@ -0,0 +1,31 @@
+Description: skip test that tries to connect to server on non-loopback address
+ nanoc tests check to make sure nanoc is not listening on non-loopback
+ addresses by trying to connect to the port and expecting connection refused.
+ However, local configuration can cause a different failure to be returned,
+ such as a timeout due to a DROP rule in a firewall.  Skip this test, which
+ is exceedingly unlikely to ever regress in the distro.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Updated: 2018-03-18
+
+Index: nanoc-4.8.10/spec/nanoc/cli/commands/view_spec.rb
+===================================================================
+--- nanoc-4.8.10.orig/spec/nanoc/cli/commands/view_spec.rb
++++ nanoc-4.8.10/spec/nanoc/cli/commands/view_spec.rb
+@@ -59,17 +59,5 @@
+       end
+     end
+ 
+-    it 'does not listen on non-local interfaces' do
+-      addresses = Socket.getifaddrs.map(&:addr).select(&:ipv4?).map(&:ip_address)
+-      non_local_addresses = addresses - ['127.0.0.1']
+-
+-      if non_local_addresses.empty?
+-        skip 'Need non-local network interfaces for this spec'
+-      end
+-
+-      run_nanoc_cmd(['view', '--port', '50385']) do
+-        expect { Net::HTTP.get(non_local_addresses[0], '/', 50_385) }.to raise_error(Errno::ECONNREFUSED)
+-      end
+-    end
+   end
+ end


More information about the Pkg-ruby-extras-maintainers mailing list