r19125 - in /trunk/libhttp-server-simple-perl/debian: changelog control patches/01-test-background-return.patch patches/02-background-return.patch patches/series
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Thu Apr 24 16:26:20 UTC 2008
Author: gregoa
Date: Thu Apr 24 16:26:19 2008
New Revision: 19125
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=19125
Log:
* Use newer patch for the background() problem (cf. #439724), also written
by Niko Tyni (taken from CPAN#28122) -- closes: #477227.
* debian/control:
- small fixes
- add missing dependency on liburi-perl
Added:
trunk/libhttp-server-simple-perl/debian/patches/01-test-background-return.patch
trunk/libhttp-server-simple-perl/debian/patches/02-background-return.patch
Modified:
trunk/libhttp-server-simple-perl/debian/changelog
trunk/libhttp-server-simple-perl/debian/control
trunk/libhttp-server-simple-perl/debian/patches/series
Modified: trunk/libhttp-server-simple-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/changelog?rev=19125&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/changelog (original)
+++ trunk/libhttp-server-simple-perl/debian/changelog Thu Apr 24 16:26:19 2008
@@ -1,3 +1,13 @@
+libhttp-server-simple-perl (0.31-2) UNRELEASED; urgency=low
+
+ * Use newer patch for the background() problem (cf. #439724), also written
+ by Niko Tyni (taken from CPAN#28122) -- closes: #477227.
+ * debian/control:
+ - small fixes
+ - add missing dependency on liburi-perl
+
+ -- gregor herrmann <gregoa at debian.org> Thu, 24 Apr 2008 18:10:03 +0200
+
libhttp-server-simple-perl (0.31-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libhttp-server-simple-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/control?rev=19125&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/control (original)
+++ trunk/libhttp-server-simple-perl/debian/control Thu Apr 24 16:26:19 2008
@@ -16,11 +16,11 @@
Package: libhttp-server-simple-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}
+Depends: ${perl:Depends}, ${misc:Depends}, liburi-perl
Description: simple stand-alone HTTP server
HTTP::Server::Simple is a simple standalone HTTP server. By default, it
- doesnât thread or fork.
+ doesn't thread or fork.
.
It does, however, act as a simple frontend which can be used to build a
- standalone web-based application or turn a CGI into one. (Itâs possible to
- use Net::Server to get threading, forking, preforking and so on.
+ standalone web-based application or turn a CGI into one. (It's possible to
+ use Net::Server to get threading, forking, preforking and so on.)
Added: trunk/libhttp-server-simple-perl/debian/patches/01-test-background-return.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/patches/01-test-background-return.patch?rev=19125&op=file
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/patches/01-test-background-return.patch (added)
+++ trunk/libhttp-server-simple-perl/debian/patches/01-test-background-return.patch Thu Apr 24 16:26:19 2008
@@ -1,0 +1,59 @@
+Author: Niko Tyni
+
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439724
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477227
+http://rt.cpan.org/Public/Bug/Display.html?id=28122
+
+--- libhttp-server-simple-perl.orig/t/01live.t
++++ libhttp-server-simple-perl/t/01live.t
+@@ -1,7 +1,7 @@
+ # -*- perl -*-
+
+ use Socket;
+-use Test::More tests => 10;
++use Test::More tests => 14;
+ use strict;
+
+ # This script assumes that `localhost' will resolve to a local IP
+@@ -12,16 +12,31 @@
+
+ use HTTP::Server::Simple;
+
++package SlowServer;
++# This test class just waits a while before it starts
++# accepting connections. This makes sure that CPAN #28122 is fixed:
++# background() shouldn't return prematurely.
++
++use base qw(HTTP::Server::Simple::CGI);
++sub setup_listener {
++ my $self = shift;
++ sleep 2;
++ $self->SUPER::setup_listener();
++}
++1;
++package main;
++
+ my $DEBUG = 1 if @ARGV;
+
++my @classes = (qw(HTTP::Server::Simple SlowServer));
++for my $class (@classes)
+ {
+- my $s=HTTP::Server::Simple->new($PORT);
++ my $s = $class->new($PORT);
+ is($s->port(),$PORT,"Constructor set port correctly");
+
+ my $pid=$s->background();
+
+ like($pid, '/^-?\d+$/', 'pid is numeric');
+- select(undef,undef,undef,0.2); # wait a sec
+
+ my $content=fetch("GET / HTTP/1.1", "");
+
+@@ -35,7 +50,6 @@
+ $s->host("localhost");
+ my $pid=$s->background();
+ diag("started server on $pid");
+- select(undef,undef,undef,0.2); # wait a sec
+ like($pid, '/^-?\d+$/', 'pid is numeric');
+
+ my $content=fetch("GET / HTTP/1.1", "");
Added: trunk/libhttp-server-simple-perl/debian/patches/02-background-return.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/patches/02-background-return.patch?rev=19125&op=file
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/patches/02-background-return.patch (added)
+++ trunk/libhttp-server-simple-perl/debian/patches/02-background-return.patch Thu Apr 24 16:26:19 2008
@@ -1,0 +1,73 @@
+Author: Niko Tyni
+
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439724
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477227
+http://rt.cpan.org/Public/Bug/Display.html?id=28122
+
+--- libhttp-server-simple-perl.orig/lib/HTTP/Server/Simple.pm
++++ libhttp-server-simple-perl/lib/HTTP/Server/Simple.pm
+@@ -6,6 +6,7 @@
+ use Socket;
+ use Carp;
+ use URI::Escape;
++use IO::Select;
+
+ use vars qw($VERSION $bad_request_doc);
+ $VERSION = '0.31';
+@@ -215,15 +216,31 @@
+
+ sub background {
+ my $self = shift;
++
++ # set up a pipe so the child can tell the parent when it's ready
++ # to accept requests
++ my ($readfh, $writefh) = FileHandle::pipe;
++
+ my $child = fork;
+ die "Can't fork: $!" unless defined($child);
+- return $child if $child;
++ if ($child) { # parent
++ my $s = IO::Select->new;
++ $s->add($readfh);
++ my @ready = $s->can_read(5);
++ die("child unresponsive for 5 seconds") if !@ready;
++ my $response = <$readfh>;
++ chomp $response;
++ die("child is confused: answer '$response' != 'OK'")
++ if $response ne "OK";
++ return $child;
++ }
+
+ if ( $^O !~ /MSWin32/ ) {
+ require POSIX;
+ POSIX::setsid()
+ or die "Can't start a new session: $!";
+ }
++ $self->{_parent_handle} = $writefh;
+ $self->run();
+ }
+
+@@ -263,6 +280,7 @@
+ $self->after_setup_listener();
+ *{"$pkg\::run"} = $self->_default_run;
+ }
++ $self->_maybe_tell_parent();
+
+ local $SIG{HUP} = sub { $SERVER_SHOULD_RUN = 0; };
+
+@@ -400,6 +418,15 @@
+ }
+ }
+
++sub _maybe_tell_parent {
++ # inform the parent process that we're ready, if applicable
++ my $self = shift;
++ my $handle = $self->{_parent_handle};
++ return if !$handle;
++ print $handle "OK\n";
++ close $handle;
++ delete $self->{_parent_handle};
++}
+
+
+
Modified: trunk/libhttp-server-simple-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhttp-server-simple-perl/debian/patches/series?rev=19125&op=diff
==============================================================================
--- trunk/libhttp-server-simple-perl/debian/patches/series (original)
+++ trunk/libhttp-server-simple-perl/debian/patches/series Thu Apr 24 16:26:19 2008
@@ -1,3 +1,5 @@
-0001-add-testcase-for-CPAN-28122.patch
-0002-Signal-version-child-sends-SIGUSR1-to-the-parent-wh.patch
+#0001-add-testcase-for-CPAN-28122.patch
+#0002-Signal-version-child-sends-SIGUSR1-to-the-parent-wh.patch
#0002-Pipe-version-parent-waits-for-the-child-to-say-OK.patch
+01-test-background-return.patch
+02-background-return.patch
More information about the Pkg-perl-cvs-commits
mailing list