2.009 bump; Modernize spec file

This commit is contained in:
Jitka Plesnikova 2017-10-10 09:11:11 +02:00
parent b9a76f0d26
commit eccac8bff2
5 changed files with 55 additions and 224 deletions

View File

@ -1,24 +0,0 @@
Since 1.950, IO::Socket::SSL->SSL_verify_mode default changed
from SSL_VERIFY_NONE to SSL_VERIFY_PEER, which breaks this test.
IO::Socket::SSL version 1.31 or later is needed for the
SSL_VERIFY_NONE constant.
--- t/SSL_test.t
+++ t/SSL_test.t
@@ -53,6 +53,7 @@
use_ok qw(Net::Server::Proto::SSL) or exit;
require Net::Server;
+use IO::Socket::SSL 1.31;
@Net::Server::Test::ISA = qw(Net::Server);
sub accept {
@@ -76,6 +77,7 @@
my $remote = IO::Socket::SSL->new(
PeerAddr => $env->{'hostname'},
PeerPort => $env->{'ports'}->[0],
+ SSL_verify_mode => SSL_VERIFY_NONE,
) || die "Couldn't open child to sock: $!";
my $line = <$remote>;

View File

@ -1,91 +0,0 @@
From 128c34c9823340454dbdc16700bb67b40398a997 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Mon, 22 May 2017 18:04:28 +0100
Subject: [PATCH 1/2] Use File::Temp::tempdir in UNIX socket test/example
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
POSIX::tmpnam is insecure, and has been removed in Perl 5.26.
Instead, use File::Temp::tempdir() to create a secure tmporary
directory that the server can create its UNIX sockets in.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
examples/connection_test.pl | 14 ++++++++------
t/UNIX_test.t | 6 ++++--
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/examples/connection_test.pl b/examples/connection_test.pl
index 1ec49a1..7d8ff7a 100644
--- a/examples/connection_test.pl
+++ b/examples/connection_test.pl
@@ -20,11 +20,11 @@ connection_test.pl - Test UDP/TCP/UNIX/UNIX_DGRAM connections
# or
- perl connection_test.pl UNIX
+ perl connection_test.pl UNIX <UNIX socket directory>
# or
- perl connection_test.pl UNIX_DGRAM
+ perl connection_test.pl UNIX_DGRAM <UNIX socket directory>
=cut
@@ -34,7 +34,8 @@ use strict;
use warnings;
use base qw(Net::Server);
use IO::Socket ();
-use POSIX qw(tmpnam);
+use File::Temp qw(tempdir);
+use File::Spec::Functions qw(catdir);
use Socket qw(SOCK_DGRAM SOCK_STREAM);
sub post_bind_hook {
@@ -44,13 +45,14 @@ sub post_bind_hook {
}
}
-my $socket_file = tmpnam();
-$socket_file =~ s|/[^/]+$|/mysocket.file|;
-my $socket_file2 = $socket_file ."2";
+my $socket_dir = $ARGV[1] || tempdir();
+my $socket_file = catdir($socket_dir, 'mysocket.file');
+my $socket_file2 = catdir($socket_dir, 'mysocket.file2');
my $udp_port = 20204;
my $tcp_port = 20204;
print "\$Net::Server::VERSION = $Net::Server::VERSION\n";
+print "UNIX socket directory = $socket_dir\n";
if( @ARGV ){
if( uc($ARGV[0]) eq 'UDP' ){
diff --git a/t/UNIX_test.t b/t/UNIX_test.t
index b41f2fa..92649f2 100644
--- a/t/UNIX_test.t
+++ b/t/UNIX_test.t
@@ -2,7 +2,8 @@
package Net::Server::Test;
use strict;
-use POSIX qw(tmpnam);
+use File::Temp qw(tempdir);
+use File::Spec::Functions qw(catfile);
use English qw($UID $GID);
use FindBin qw($Bin);
use lib $Bin;
@@ -22,7 +23,8 @@ sub accept {
return shift->SUPER::accept(@_);
}
-my $socket_file = tmpnam; # must do before fork
+my $socket_dir = tempdir();
+my $socket_file = catfile($socket_dir, 'socket'); # must do before fork
my $ok = eval {
local $SIG{'ALRM'} = sub { die "Timeout\n" };
alarm $env->{'timeout'};
--
2.9.4

View File

@ -1,82 +0,0 @@
From a3f1f13fec367e03f298abf53bf702c6c5ba76a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Mon, 22 May 2017 18:05:58 +0100
Subject: [PATCH] Use File::Temp::tempfile instead of POSIX::tmpnam for lock
file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
POSIX::tmpnam is insecure, and has been removed in Perl 5.26.
Instead, use File::Temp::tempfile to create the lock file.
Petr Písař: Ported to 2.008.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Makefile.PL | 1 +
lib/Net/Server/PreFork.pm | 2 +-
lib/Net/Server/PreForkSimple.pm | 8 ++++++--
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index ea3edc2..58713a9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -9,6 +9,7 @@ my %args =
AUTHOR => 'Paul Seamons <paul@seamons.com> and Rob Brown <bbb@cpan.org>',
EXE_FILES => [ 'bin/net-server' ],
PREREQ_PM => {
+ "File::Temp" => 0,
'IO::Socket' => 0,
Socket => 0,
POSIX => 0,
diff --git a/lib/Net/Server/PreFork.pm b/lib/Net/Server/PreFork.pm
index d986f1a..40b2dfa 100644
--- a/lib/Net/Server/PreFork.pm
+++ b/lib/Net/Server/PreFork.pm
@@ -512,7 +512,7 @@ You really should also see L<Net::Server::PreForkSimple>.
serialize (flock|semaphore
|pipe|none) undef
# serialize defaults to flock on multi_port or on Solaris
- lock_file "filename" File::Temp::tempfile or POSIX::tmpnam
+ lock_file "filename" File::Temp->new
check_for_dead \d+ 30
check_for_waiting \d+ 10
diff --git a/lib/Net/Server/PreForkSimple.pm b/lib/Net/Server/PreForkSimple.pm
index fcccb74..03805c7 100644
--- a/lib/Net/Server/PreForkSimple.pm
+++ b/lib/Net/Server/PreForkSimple.pm
@@ -23,6 +23,7 @@ package Net::Server::PreForkSimple;
use strict;
use base qw(Net::Server);
+use File::Temp qw(tempfile);
use Net::Server::SIG qw(register_sig check_sigs);
use POSIX qw(WNOHANG EINTR);
use Fcntl ();
@@ -81,7 +82,10 @@ sub post_bind {
if (defined $prop->{'lock_file'}) {
$prop->{'lock_file_unlink'} = undef;
} else {
- $prop->{'lock_file'} = eval { require File::Temp } ? File::Temp::tmpnam() : POSIX::tmpnam();
+ (my $fh, $prop->{'lock_file'}) = tempfile();
+ # We don't need to keep the file handle open in the parent;
+ # each child opens it separately to avoid sharing the lock
+ close $fh or die "Cannot close lock file $prop->{'lock_file'}: $!";
$prop->{'lock_file_unlink'} = 1;
}
@@ -407,7 +411,7 @@ parameters.
serialize (flock|semaphore
|pipe|none) undef
# serialize defaults to flock on multi_port or on Solaris
- lock_file "filename" File::Temp::tempfile or POSIX::tmpnam
+ lock_file "filename" File::Temp->new
check_for_dead \d+ 30
--
2.9.4

View File

@ -1,36 +1,66 @@
Name: perl-Net-Server
Version: 2.008
Release: 10%{?dist}
Version: 2.009
Release: 1%{?dist}
Summary: Extensible, general Perl server engine
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/Net-Server/
Source0: http://www.cpan.org/modules/by-module/Net/Net-Server-%{version}.tar.gz
# 1/2 Restore compatibility with Perl 5.26.0,
# <https://github.com/rhandom/perl-net-server/issues/9>,
# fix from <https://github.com/rhandom/perl-net-server/pull/10>
Patch0: Net-Server-2.008-Use-File-Temp-tempdir-in-UNIX-socket-test-example.patch
# 2/2 Restore compatibility with Perl 5.26.0,
# <https://github.com/rhandom/perl-net-server/issues/9>,
# fix from <https://github.com/rhandom/perl-net-server/pull/10>
Patch1: Net-Server-2.008-Use-File-Temp-tempfile-instead-of-POSIX-tmpnam-for-l.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl-interpreter
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
# Run-time
BuildRequires: perl(base)
BuildRequires: perl(Carp)
# BuildRequires: perl(CGI)
# BuildRequires: perl(CGI::Compile)
# BuildRequires: perl(CGI::PSGI)
# BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Errno)
BuildRequires: perl(Exporter)
BuildRequires: perl(Fcntl)
BuildRequires: perl(File::Temp)
BuildRequires: perl(Socket)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# Also buildreq various optional modules for test suite
# BuildRequires: perl(HTTP::Parser::XS)
BuildRequires: perl(IO::Handle)
BuildRequires: perl(IO::Multiplex) >= 1.05
BuildRequires: perl(IO::Select)
BuildRequires: perl(IO::Socket)
# BuildRequires: perl(IO::Socket::INET)
BuildRequires: perl(IO::Socket::INET6)
BuildRequires: perl(IO::Socket::SSL) >= 1.31
BuildRequires: perl(IO::Socket::UNIX)
# BuildRequires: perl(IPC::Open3)
# BuildRequires: perl(IPC::Semaphore)
# BuildRequires: perl(IPC::SysV)
BuildRequires: perl(Log::Log4perl)
# BuildRequires: perl(Net::CIDR)
BuildRequires: perl(Net::SSLeay)
BuildRequires: perl(POSIX)
BuildRequires: perl(re)
BuildRequires: perl(Scalar::Util)
BuildRequires: perl(Socket)
BuildRequires: perl(Socket6)
# BuildRequires: perl(Symbol)
# BuildRequires: perl(Sys::Syslog)
BuildRequires: perl(Time::HiRes)
# BuildRequires: perl(Unix::Syslog)
BuildRequires: perl(vars)
# Tests
BuildRequires: perl(constant)
BuildRequires: perl(English)
BuildRequires: perl(File::Spec::Functions)
BuildRequires: perl(FindBin)
BuildRequires: perl(lib)
BuildRequires: perl(threads)
BuildRequires: perl(Test::More)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# IO::Multiplex support is optional, but not including it causes build problems in some packages...
Requires: perl(IO::Multiplex) >= 1.05
# RHBZ#1395714: Optional dependency, including it so that the build matches runtime
@ -42,29 +72,23 @@ be the back end layer of internet protocol servers.
%prep
%setup -q -n Net-Server-%{version}
%patch0 -p1
%patch1 -p1
# Do not want to pull in any packaging deps here.
chmod -c 644 examples/*
%build
perl Makefile.PL INSTALLDIRS=vendor
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make pure_install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
%{_fixperms} $RPM_BUILD_ROOT
%check
make test
%clean
rm -rf $RPM_BUILD_ROOT
%files
%license LICENSE
%doc Changes README examples
%{perl_vendorlib}/*
%{_mandir}/man3/*
@ -72,6 +96,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/net-server.1*
%changelog
* Tue Oct 10 2017 Jitka Plesnikova <jplesnik@redhat.com> - 2.009-1
- 2.009 bump
- Modernize spec file
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.008-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

View File

@ -1 +1 @@
85d488bc800f582839dd924ffa3f0d26 Net-Server-2.008.tar.gz
SHA512 (Net-Server-2.009.tar.gz) = 36409f8d2478877c68cbfcbe9c08045b0c24a926b64f022faf3de8f4b4369ff417d5c41ff1e9800553c38da29c6d72ef301119c956cb26439f6b6366ff4b459c