From d99c2be911b4be5d643257a1d09c3622087c5bf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Tue, 11 Apr 2017 14:03:16 +0200
Subject: 1.8.0 bump

---
 .gitignore                                         |  1 +
 ...L-715-Force-localhost-to-connect-via-IPv4.patch | 75 ++++++++++++++++++++++
 perl-MongoDB.spec                                  | 14 +++-
 sources                                            |  2 +-
 4 files changed, 88 insertions(+), 4 deletions(-)
 create mode 100644 
MongoDB-1.6.0-PERL-715-Force-localhost-to-connect-via-IPv4.patch

diff --git a/.gitignore b/.gitignore
index 91be38f..0c2107e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
 /MongoDB-v1.4.5.tar.gz
 /MongoDB-v1.6.0.tar.gz
 /MongoDB-v1.6.1.tar.gz
+/MongoDB-v1.8.0.tar.gz
diff --git a/MongoDB-1.6.0-PERL-715-Force-localhost-to-connect-via-IPv4.patch 
b/MongoDB-1.6.0-PERL-715-Force-localhost-to-connect-via-IPv4.patch
new file mode 100644
index 0000000..fc257dc
--- /dev/null
+++ b/MongoDB-1.6.0-PERL-715-Force-localhost-to-connect-via-IPv4.patch
@@ -0,0 +1,75 @@
+From 3bf06890a2675e323e09a0ff123f572ad23b2627 Mon Sep 17 00:00:00 2001
+From: David Golden <x...@xdg.me>
+Date: Mon, 6 Mar 2017 23:36:35 -0500
+Subject: [PATCH] PERL-715 Force localhost to connect via IPv4
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Some operating systems return IPv6 localhost addresses first, which fail
+to connect if MongoDB isn't running on IPv6.  This commit makes
+localhost only use IPv4.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ lib/MongoDB/_Link.pm |  9 ++++++++-
+ t/connection.t       | 15 +++++++++++++++
+ 2 files changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/lib/MongoDB/_Link.pm b/lib/MongoDB/_Link.pm
+index e3cbde3..17b4212 100644
+--- a/lib/MongoDB/_Link.pm
++++ b/lib/MongoDB/_Link.pm
+@@ -31,7 +31,7 @@ use Moo;
+ use Errno qw[EINTR EPIPE];
+ use IO::Socket qw[SOCK_STREAM];
+ use Scalar::Util qw/refaddr/;
+-use Socket qw/SOL_SOCKET SO_KEEPALIVE SO_RCVBUF IPPROTO_TCP TCP_NODELAY/;
++use Socket qw/SOL_SOCKET SO_KEEPALIVE SO_RCVBUF IPPROTO_TCP TCP_NODELAY 
AF_INET/;
+ use Time::HiRes qw/time/;
+ use MongoDB::Error;
+ use MongoDB::_Constants;
+@@ -165,9 +165,16 @@ sub connect {
+ 
+     my ($host, $port) = split /:/, $self->address;
+ 
++    # PERL-715: For 'localhost' where MongoDB is only listening on IPv4 and
++    # getaddrinfo returns an IPv6 address before an IPv4 address, some
++    # operating systems tickle a bug in IO::Socket::IP that causes
++    # connection attempts to fail before trying the IPv4 address.  As a
++    # workaround, we always force 'localhost' to use IPv4.
++
+     my $fh = $SOCKET_CLASS->new(
+         PeerHost => $host,
+         PeerPort => $port,
++        ( lc($host) eq 'localhost' ? ( Family => AF_INET ) : () ),
+         Proto    => 'tcp',
+         Type     => SOCK_STREAM,
+         Timeout  => $self->connect_timeout >= 0 ? $self->connect_timeout : 
undef,
+diff --git a/t/connection.t b/t/connection.t
+index ac38658..418eb99 100644
+--- a/t/connection.t
++++ b/t/connection.t
+@@ -123,4 +123,19 @@ subtest "app name" => sub {
+         "expected to see app name in client doc from currentOp output" );
+ };
+ 
++subtest "localhost translated to 127.0.0.1" => sub {
++    my $topo = $conn->_topology;
++    $topo->scan_all_servers;
++    my $link = $topo->get_readable_link;
++    my $fh = $link->fh;
++
++    plan skip_all => "Test needs IO::Socket::IP and localhost mongod"
++        unless $fh->isa("IO::Socket::IP") && $conn->host =~ /localhost/;
++
++    # IO::Socket::IP::as_inet is fatal unless socket is PF_INET
++    eval { $fh->as_inet };
++    is( $@, '', "Socket can convert to plain INET (IPv4)" );
++};
++
++
+ done_testing;
+-- 
+2.7.4
+
diff --git a/perl-MongoDB.spec b/perl-MongoDB.spec
index 59dbe53..0e1151a 100644
--- a/perl-MongoDB.spec
+++ b/perl-MongoDB.spec
@@ -1,6 +1,6 @@
 Name:           perl-MongoDB
-Version:        1.6.1
-Release:        2%{?dist}
+Version:        1.8.0
+Release:        1%{?dist}
 Summary:        A MongoDB Driver for Perl
 ## Installed:
 # lib/MongoDB/_Link.pm:             ASL 2.0 and (GPL+ or Artistic)
@@ -18,6 +18,8 @@ URL:            http://search.cpan.org/dist/MongoDB/
 Source0:        
http://www.cpan.org/authors/id/M/MO/MONGODB/MongoDB-v%{version}.tar.gz
 # Use system libbson if available <https://jira.mongodb.org/browse/PERL-521>
 Patch0:         MongoDB-v1.2.2-Use-system-libbson-library-if-possible.patch
+# Revert "localhost is IPv4 only" <https://jira.mongodb.org/browse/PERL-715>
+Patch1:         
MongoDB-1.6.0-PERL-715-Force-localhost-to-connect-via-IPv4.patch
 # Build:
 BuildRequires:  coreutils
 BuildRequires:  findutils
@@ -32,6 +34,7 @@ BuildRequires:  perl(constant)
 BuildRequires:  perl(Cwd)
 BuildRequires:  perl(File::Spec::Functions)
 BuildRequires:  perl(inc::Module::Install)
+BuildRequires:  perl(lib)
 BuildRequires:  perl(Module::Install::Base)
 BuildRequires:  perl(Module::Install::Compiler)
 BuildRequires:  perl(Module::Install::Metadata)
@@ -94,7 +97,6 @@ BuildRequires:  perl(File::Spec)
 BuildRequires:  perl(File::Temp)
 BuildRequires:  perl(FileHandle)
 BuildRequires:  perl(JSON::MaybeXS) >= 1.002005
-BuildRequires:  perl(lib)
 BuildRequires:  perl(Math::BigInt)
 BuildRequires:  perl(Test::Deep) >= 0.111
 BuildRequires:  perl(Test::Fatal)
@@ -144,6 +146,8 @@ The perl database access module for MongoDB.
 %patch0 -p1
 rm -r bson
 sed -i -e '/^bson\//d' MANIFEST
+# Revert "localhost is IPv4 only" feature
+%patch1 -R -p1
 # Remove bundled modules
 find inc/Module -type f \! -name Mongo.pm \
     -exec rm -- {} \; -exec sed -i '\,{},d' MANIFEST \;
@@ -188,6 +192,10 @@ exit $test_rc
 %{_mandir}/man3/*
 
 %changelog
+* Tue Apr 11 2017 Petr Pisar <ppi...@redhat.com> - 1.8.0-1
+- 1.8.0 bump
+- Revert localhost is IPv4 only feature
+
 * Fri Feb 24 2017 Petr Pisar <ppi...@redhat.com> - 1.6.1-2
 - Enable builds on 64-bit big-endian platforms
 
diff --git a/sources b/sources
index 5a6c1b0..0809bcf 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (MongoDB-v1.6.1.tar.gz) = 
a1a539a04d604f7b8184581ede17cf564c9c0c4453cea156912e64d0c1be8ccd0294ba45a0c0e5253053cad5a72bf5445e9cf02e5b31c55c178c5a5d31a15a3b
+SHA512 (MongoDB-v1.8.0.tar.gz) = 
1346a1c82528f409f467e77cb713af856d8dcd90ff57d07ce9312d60a16c7b7922dc99fb23a5374447ba61a082de43eccd495c779cd8a32463a039a6a13fa427
-- 
cgit v1.1


        
https://src.fedoraproject.org/cgit/perl-MongoDB.git/commit/?h=f26&id=d99c2be911b4be5d643257a1d09c3622087c5bf6
_______________________________________________
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org

Reply via email to