Package: perl
Version: 5.14.2-17
Severity: important
Forwarded: https://rt.perl.org/rt3/Public/Bug/Display.html?id=116621
Tags: patch fixed-upstream

On Tue, Feb 05, 2013 at 05:42:02PM +0000, Dmitry Panov wrote:

> I also found the same bug (by googling the commit id) reported and
> fixed in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=767931
> It's a shame it's still present in Ubuntu and Debian...

Reporting it in Debian would help a long way towards fixing it.
Doing that now as I happened to notice the thread.

A couple of weeks ago it would have had a better chance for making it
into the upcoming wheezy release; it may well be too late now. OTOH as
a regression from squeeze it may still be eligible.

I'm attaching a slightly more compact version of the test script at
[perl #116621]. It consistently fails for me on sid/amd64 (perl 5.14.2)
but succeeds on squeeze (perl 5.10.1).

This is fixed in 5.15.4 by 
 
http://perl5.git.perl.org/perl.git/commit/be48bbe8d671b6841c3ec7cb734b98071afe3cd9
which is also attached for convenience. 

I've verified that the patch applies to our 5.14.2 package and fixes
the issue.
-- 
Niko Tyni   nt...@debian.org
#!/usr/bin/perl

use Time::HiRes qw( usleep );
my $MAX = 1000;

if (open my $f, "|-") { # parent
    my $s = "1\n";
    my $l = length($s);

    my $i=0;
    while ($i++ < $MAX) {
        syswrite($f, $s, $l);
        usleep(rand()*30000);
    }
} else { # kid
    local $SIG{CHLD} = sub { wait };
    my $j=0;
    $j++, fork or exit while (<>);
    print $j == $MAX ? "ok # reached $j tries\n" :
                       "not ok # exited after $j tries\n";
}

>From be48bbe8d671b6841c3ec7cb734b98071afe3cd9 Mon Sep 17 00:00:00 2001
From: Chip <c...@pobox.com>
Date: Mon, 19 Sep 2011 23:51:49 -0700
Subject: [PATCH] add a couple missing LEAVEs in perlio_async_run()

---
 perlio.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/perlio.c b/perlio.c
index f0d67ae..79c6fdf 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2563,8 +2563,10 @@ S_perlio_async_run(pTHX_ PerlIO* f) {
     SAVEDESTRUCTOR_X(S_lockcnt_dec, (void*)f);
     PerlIO_lockcnt(f)++;
     PERL_ASYNC_CHECK();
-    if ( !(PerlIOBase(f)->flags & PERLIO_F_CLEARED) )
+    if ( !(PerlIOBase(f)->flags & PERLIO_F_CLEARED) ) {
+	LEAVE;
 	return 0;
+    }
     /* we've just run some perl-level code that could have done
      * anything, including closing the file or clearing this layer.
      * If so, free any lower layers that have already been
@@ -2576,6 +2578,7 @@ S_perlio_async_run(pTHX_ PerlIO* f) {
 	*f = l->next;
 	Safefree(l);
     }
+    LEAVE;
     return 1;
 }
 
-- 
1.7.10.4

Reply via email to