In perl.git, the branch maint-5.10 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/0301b72fccf90dabc20db302056f30d003cf7a6c?hp=0b88e241bb295984cbd4eb10a5cceae527ef30ec>

- Log -----------------------------------------------------------------
commit 0301b72fccf90dabc20db302056f30d003cf7a6c
Author: Rafael Garcia-Suarez <[email protected]>
Date:   Tue May 5 16:42:09 2009 +0200

    Bump $VERSION of FileCache
    
    (cherry picked from commit 045cad9882c9f6627b184bc0df58f61cf25b5cd7)

M       lib/FileCache.pm

commit 9080fada22ee6ed5bc449fec8d8279aeb06e7fd1
Author: Niko Tyni <[email protected]>
Date:   Tue May 5 09:07:57 2009 +0300

    Document that FileCache uses symbolic references
    
    As noted by Marc Haber in <http://bugs.debian.org/318579>,
    using FileCache.pm as per the SYNOPSIS doesn't work under
    'use strict'. This is a bit unexpected nowadays, so mention
    it in the documentation.
    
    (cherry picked from commit 46f1a616f56f167d0a5af6a2d90cd809d2bd03d1)

M       lib/FileCache.pm

commit e5dcf133c73ee51091b6e2d78383ab89e94f51f3
Author: Nicholas Clark <[email protected]>
Date:   Mon May 4 22:58:02 2009 +0100

    In Perl_gp_dup(), no need to explicitly zero ret->gp_refcnt after the 
Newxz().
    
    (cherry picked from commit 46d6503777f357c38f9d1cde19b6d3d1c6f36d3d)

M       sv.c

commit 588c5411da0219e3ceedcda16a5202c14e509e9b
Author: Nicholas Clark <[email protected]>
Date:   Mon May 4 18:53:39 2009 +0100

    Make Perl_hek_dup() cope with a NULL "source" parameter (by returning NULL).
    Change its callers to take advantage of this.
    
    (cherry picked from commit 566771cc1208eb7c5c8363435c4bd1299f0ae5e5)

M       hv.c
M       sv.c

commit 977da434dbc625ef69a4decb9567193166979ce9
Author: Nicholas Clark <[email protected]>
Date:   Mon May 4 18:12:03 2009 +0100

    Fix SEGVs when cloning a typeglob that has been undefined. (RT #64954)
    
    (cherry picked from commit 1dffc4d1a24556f4e23f612d6713492847ff064b)

M       sv.c
M       t/op/threads.t

commit adbffa0f5b16713d962eb1e37aa3b6f889136560
Author: Nicholas Clark <[email protected]>
Date:   Thu Dec 27 20:33:55 2007 +0000

    Test that we can clone regexps into new threads, and fix the bug in
    change 32740 that this reveals. (Bug spotted by, and initial patch
    from, Jerry D. Hedden.)
    
    (Just the tests: cherry-picked from commit
    f708cfc10f5ba0c4e1efa412ff01f165ea63f555)
    
    p4raw-id: //depot/p...@32745

M       t/op/threads.t
-----------------------------------------------------------------------

Summary of changes:
 hv.c             |    6 +++++-
 lib/FileCache.pm |    7 ++++++-
 sv.c             |    8 ++++----
 t/op/threads.t   |   16 +++++++++++++++-
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/hv.c b/hv.c
index c150893..1776053 100644
--- a/hv.c
+++ b/hv.c
@@ -134,11 +134,15 @@ Perl_free_tied_hv_pool(pTHX)
 HEK *
 Perl_hek_dup(pTHX_ HEK *source, CLONE_PARAMS* param)
 {
-    HEK *shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
+    HEK *shared;
 
     PERL_ARGS_ASSERT_HEK_DUP;
     PERL_UNUSED_ARG(param);
 
+    if (!source)
+       return NULL;
+
+    shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
     if (shared) {
        /* We already shared this hash key.  */
        (void)share_hek_hek(shared);
diff --git a/lib/FileCache.pm b/lib/FileCache.pm
index 285307f..09583b0 100644
--- a/lib/FileCache.pm
+++ b/lib/FileCache.pm
@@ -1,6 +1,6 @@
 package FileCache;
 
-our $VERSION = '1.07';
+our $VERSION = '1.08';
 
 =head1 NAME
 
@@ -8,6 +8,8 @@ FileCache - keep more files open than the system permits
 
 =head1 SYNOPSIS
 
+    no strict 'refs';
+
     use FileCache;
     # or
     use FileCache maxopen => 16;
@@ -71,6 +73,9 @@ FileCache does not store the current file offset if it finds 
it necessary to
 close a file.  When the file is reopened, the offset will be as specified by 
the
 original C<open> file mode.  This could be construed to be a bug.
 
+The module functionality relies on symbolic references, so things will break
+under 'use strict' unless 'no strict "refs"' is also specified.
+
 =head1 BUGS
 
 F<sys/param.h> lies with its C<NOFILE> define on some systems,
diff --git a/sv.c b/sv.c
index 57853e1..4ff7f40 100644
--- a/sv.c
+++ b/sv.c
@@ -10236,7 +10236,8 @@ Perl_gp_dup(pTHX_ GP *gp, CLONE_PARAMS* param)
     ptr_table_store(PL_ptr_table, gp, ret);
 
     /* clone */
-    ret->gp_refcnt     = 0;                    /* must be before any other 
dups! */
+    /* ret->gp_refcnt must be 0 before any other dups are called. We're relying
+       on Newxz() to do this for us.  */
     ret->gp_sv         = sv_dup_inc(gp->gp_sv, param);
     ret->gp_io         = io_dup_inc(gp->gp_io, param);
     ret->gp_form       = cv_dup_inc(gp->gp_form, param);
@@ -10693,8 +10694,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
                    LvTARG(dstr) = sv_dup_inc(LvTARG(dstr), param);
            case SVt_PVGV:
                if(isGV_with_GP(sstr)) {
-                   if (GvNAME_HEK(dstr))
-                       GvNAME_HEK(dstr) = hek_dup(GvNAME_HEK(dstr), param);
+                   GvNAME_HEK(dstr) = hek_dup(GvNAME_HEK(dstr), param);
                    /* Don't call sv_add_backref here as it's going to be
                       created as part of the magic cloning of the symbol
                       table.  */
@@ -10792,7 +10792,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
                        SvFLAGS(dstr) |= SVf_OOK;
 
                        hvname = saux->xhv_name;
-                       daux->xhv_name = hvname ? hek_dup(hvname, param) : 
hvname;
+                       daux->xhv_name = hek_dup(hvname, param);
 
                        daux->xhv_riter = saux->xhv_riter;
                        daux->xhv_eiter = saux->xhv_eiter
diff --git a/t/op/threads.t b/t/op/threads.t
index 5e3b1af..9a3967a 100644
--- a/t/op/threads.t
+++ b/t/op/threads.t
@@ -16,7 +16,7 @@ BEGIN {
        exit 0;
      }
 
-     plan(11);
+     plan(14);
 }
 
 use strict;
@@ -159,6 +159,15 @@ EOI
     ok(1, '[perl #45053]');
 }
 
+sub matchit {
+    is (ref $_[1], "Regexp");
+    like ($_[0], $_[1]);
+}
+
+threads->new(\&matchit, "Pie", qr/pie/i)->join();
+
+# tests in threads don't get counted, so
+curr_test(curr_test() + 2);
 
 # the seen_evals field of a regexp was getting zeroed on clone, so
 # within a thread it didn't  know that a regex object contrained a 'safe'
@@ -175,5 +184,10 @@ threads->new(\&safe_re)->join();
 # tests in threads don't get counted, so
 curr_test(curr_test() + 1);
 
+# This used to crash in 5.10.0 [perl #64954]
+
+undef *a;
+threads->new(sub {})->join;
+pass("undefing a typeglob doesn't cause a crash during cloning");
 
 # EOF

--
Perl5 Master Repository

Reply via email to