r59068 - in /branches/upstream/libindirect-perl/current: Changes MANIFEST META.yml Makefile.PL README indirect.xs lib/indirect.pm reap.h t/30-scope.t t/lib/indirect/TestRequired6.pm

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Tue Jun 8 16:23:27 UTC 2010


Author: angelabad-guest
Date: Tue Jun  8 16:22:58 2010
New Revision: 59068

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59068
Log:
[svn-upgrade] new version libindirect-perl (0.21)

Added:
    branches/upstream/libindirect-perl/current/reap.h
    branches/upstream/libindirect-perl/current/t/lib/indirect/TestRequired6.pm
Modified:
    branches/upstream/libindirect-perl/current/Changes
    branches/upstream/libindirect-perl/current/MANIFEST
    branches/upstream/libindirect-perl/current/META.yml
    branches/upstream/libindirect-perl/current/Makefile.PL
    branches/upstream/libindirect-perl/current/README
    branches/upstream/libindirect-perl/current/indirect.xs
    branches/upstream/libindirect-perl/current/lib/indirect.pm
    branches/upstream/libindirect-perl/current/t/30-scope.t

Modified: branches/upstream/libindirect-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/Changes?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/Changes (original)
+++ branches/upstream/libindirect-perl/current/Changes Tue Jun  8 16:22:58 2010
@@ -1,4 +1,12 @@
 Revision history for indirect
+
+0.21    2010-05-31 23:10 UTC
+        + Chg : perl 5.8.1 is now required (instead of 5.8.0).
+        + Fix : [RT #57699] : indirect fail with 64-bit int on 5.13.1.
+                It was actually a problem with thread destructors segfaulting
+                because they weren't called at the right time anymore.
+                Thanks Andrew Main for reporting.
+        + Tst : A few more regression tests about the scope leak bug.
 
 0.20    2010-04-18 21:25 UTC
         + Fix : [RT #50570] : "indirect" leaking into LWP.

Modified: branches/upstream/libindirect-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/MANIFEST?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/MANIFEST (original)
+++ branches/upstream/libindirect-perl/current/MANIFEST Tue Jun  8 16:22:58 2010
@@ -6,6 +6,7 @@
 indirect.xs
 lib/indirect.pm
 ptable.h
+reap.h
 samples/indirect.pl
 t/00-load.t
 t/10-args.t
@@ -40,3 +41,4 @@
 t/lib/indirect/TestRequired5/b0.pm
 t/lib/indirect/TestRequired5/c0.pm
 t/lib/indirect/TestRequired5/d0.pm
+t/lib/indirect/TestRequired6.pm

Modified: branches/upstream/libindirect-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/META.yml?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/META.yml (original)
+++ branches/upstream/libindirect-perl/current/META.yml Tue Jun  8 16:22:58 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               indirect
-version:            0.20
+version:            0.21
 abstract:           Lexically warn about using the indirect object syntax.
 author:
     - Vincent Pit <perl at profvince.com>
@@ -13,7 +13,7 @@
     Test::More:           0
     XSLoader:             0
 requires:
-    perl:      5.008
+    perl:      5.008001
     XSLoader:  0
 resources:
     bugtracker:  http://rt.cpan.org/NoAuth/ReportBug.html?Queue=indirect

Modified: branches/upstream/libindirect-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/Makefile.PL?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/Makefile.PL (original)
+++ branches/upstream/libindirect-perl/current/Makefile.PL Tue Jun  8 16:22:58 2010
@@ -1,4 +1,4 @@
-use 5.008;
+use 5.008001;
 
 use strict;
 use warnings;
@@ -56,7 +56,7 @@
  PL_FILES         => {},
  @DEFINES,
  PREREQ_PM        => \%PREREQ_PM,
- MIN_PERL_VERSION => 5.008,
+ MIN_PERL_VERSION => 5.008001,
  META_MERGE       => \%META,
  dist             => {
   PREOP    => "pod2text $file > \$(DISTVNAME)/README",

Modified: branches/upstream/libindirect-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/README?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/README (original)
+++ branches/upstream/libindirect-perl/current/README Tue Jun  8 16:22:58 2010
@@ -2,7 +2,7 @@
     indirect - Lexically warn about using the indirect object syntax.
 
 VERSION
-    Version 0.20
+    Version 0.21
 
 SYNOPSIS
         # In a script
@@ -120,7 +120,7 @@
     Hence "my $x = new Class if 0" will be caught.
 
 DEPENDENCIES
-    perl 5.8.
+    perl 5.8.1.
 
     XSLoader (standard since perl 5.006).
 

Modified: branches/upstream/libindirect-perl/current/indirect.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/indirect.xs?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/indirect.xs (original)
+++ branches/upstream/libindirect-perl/current/indirect.xs Tue Jun  8 16:22:58 2010
@@ -60,20 +60,6 @@
 #endif
 
 #define I_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
-
-#undef ENTERn
-#if defined(ENTER_with_name) && !I_HAS_PERL(5, 11, 4)
-# define ENTERn(N) ENTER_with_name(N)
-#else
-# define ENTERn(N) ENTER
-#endif
-
-#undef LEAVEn
-#if defined(LEAVE_with_name) && !I_HAS_PERL(5, 11, 4)
-# define LEAVEn(N) LEAVE_with_name(N)
-#else
-# define LEAVEn(N) LEAVE
-#endif
 
 #if I_HAS_PERL(5, 10, 0) || defined(PL_parser)
 # ifndef PL_lex_inwhat
@@ -288,22 +274,13 @@
  ptable_hints_store(ud->tbl, ent->key, h2);
 }
 
-STATIC void indirect_thread_cleanup(pTHX_ void *);
+#include "reap.h"
 
 STATIC void indirect_thread_cleanup(pTHX_ void *ud) {
- int *level = ud;
-
- if (*level) {
-  *level = 0;
-  LEAVE;
-  SAVEDESTRUCTOR_X(indirect_thread_cleanup, level);
-  ENTER;
- } else {
-  dMY_CXT;
-  PerlMemShared_free(level);
-  ptable_free(MY_CXT.map);
-  ptable_hints_free(MY_CXT.tbl);
- }
+ dMY_CXT;
+
+ ptable_free(MY_CXT.map);
+ ptable_hints_free(MY_CXT.tbl);
 }
 
 #endif /* I_THREADSAFE */
@@ -840,13 +817,15 @@
  if (indirect_initialized)
   return;
 
- MY_CXT_INIT;
+ {
+  MY_CXT_INIT;
 #if I_THREADSAFE
- MY_CXT.tbl     = ptable_new();
- MY_CXT.owner   = aTHX;
-#endif
- MY_CXT.map     = ptable_new();
- MY_CXT.linestr = NULL;
+  MY_CXT.tbl     = ptable_new();
+  MY_CXT.owner   = aTHX;
+#endif
+  MY_CXT.map     = ptable_new();
+  MY_CXT.linestr = NULL;
+ }
 
  indirect_old_ck_const    = PL_check[OP_CONST];
  PL_check[OP_CONST]       = MEMBER_TO_FPTR(indirect_ck_const);
@@ -903,8 +882,7 @@
 PROTOTYPE: DISABLE
 PREINIT:
  ptable *t;
- int    *level;
-CODE:
+PPCODE:
  {
   my_cxt_t ud;
   dMY_CXT;
@@ -919,13 +897,8 @@
   MY_CXT.tbl     = t;
   MY_CXT.owner   = aTHX;
  }
- {
-  level = PerlMemShared_malloc(sizeof *level);
-  *level = 1;
-  LEAVEn("sub");
-  SAVEDESTRUCTOR_X(indirect_thread_cleanup, level);
-  ENTERn("sub");
- }
+ reap(3, indirect_thread_cleanup, NULL);
+ XSRETURN(0);
 
 #endif
 

Modified: branches/upstream/libindirect-perl/current/lib/indirect.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/lib/indirect.pm?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/lib/indirect.pm (original)
+++ branches/upstream/libindirect-perl/current/lib/indirect.pm Tue Jun  8 16:22:58 2010
@@ -1,6 +1,6 @@
 package indirect;
 
-use 5.008;
+use 5.008001;
 
 use strict;
 use warnings;
@@ -11,13 +11,13 @@
 
 =head1 VERSION
 
-Version 0.20
+Version 0.21
 
 =cut
 
 our $VERSION;
 BEGIN {
- $VERSION = '0.20';
+ $VERSION = '0.21';
 }
 
 =head1 SYNOPSIS
@@ -191,7 +191,7 @@
 
 =head1 DEPENDENCIES
 
-L<perl> 5.8.
+L<perl> 5.8.1.
 
 L<XSLoader> (standard since perl 5.006).
 

Added: branches/upstream/libindirect-perl/current/reap.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/reap.h?rev=59068&op=file
==============================================================================
--- branches/upstream/libindirect-perl/current/reap.h (added)
+++ branches/upstream/libindirect-perl/current/reap.h Tue Jun  8 16:22:58 2010
@@ -1,0 +1,81 @@
+/* This file is part of the indirect Perl module.
+ * See http://search.cpan.org/dist/indirect/ */
+
+/* This header provides a specialized version of Scope::Upper::reap that can be
+ * called directly from XS.
+ * See http://search.cpan.org/dist/Scope-Upper/ for details. */
+
+#ifndef REAP_H
+#define REAP_H 1
+
+#define REAP_DESTRUCTOR_SIZE 3
+
+typedef struct {
+ I32    depth;
+ I32   *origin;
+ void (*cb)(pTHX_ void *);
+ void  *ud;
+ char  *dummy;
+} reap_ud;
+
+STATIC void reap_pop(pTHX_ void *);
+
+STATIC void reap_pop(pTHX_ void *ud_) {
+ reap_ud *ud = ud_;
+ I32 depth, *origin, mark, base;
+
+ depth  = ud->depth;
+ origin = ud->origin;
+ mark   = origin[depth];
+ base   = origin[depth - 1];
+
+ if (base < mark) {
+  PL_savestack_ix = mark;
+  leave_scope(base);
+ }
+ PL_savestack_ix = base;
+
+ if ((ud->depth = --depth) > 0) {
+  SAVEDESTRUCTOR_X(reap_pop, ud);
+ } else {
+  void (*cb)(pTHX_ void *) = ud->cb;
+  void  *cb_ud             = ud->ud;
+
+  PerlMemShared_free(ud->origin);
+  PerlMemShared_free(ud);
+
+  SAVEDESTRUCTOR_X(cb, cb_ud);
+ }
+}
+
+STATIC void reap(pTHX_ I32 depth, void (*cb)(pTHX_ void *), void *cb_ud) {
+#define reap(D, CB, UD) reap(aTHX_ (D), (CB), (UD))
+ reap_ud *ud;
+ I32 i;
+
+ if (depth > PL_scopestack_ix)
+  depth = PL_scopestack_ix;
+
+ ud         = PerlMemShared_malloc(sizeof *ud);
+ ud->depth  = depth;
+ ud->origin = PerlMemShared_malloc((depth + 1) * sizeof *ud->origin);
+ ud->cb     = cb;
+ ud->ud     = cb_ud;
+ ud->dummy  = NULL;
+
+ for (i = depth; i >= 1; --i) {
+  I32 j = PL_scopestack_ix - i;
+  ud->origin[depth - i] = PL_scopestack[j];
+  PL_scopestack[j] += REAP_DESTRUCTOR_SIZE;
+ }
+ ud->origin[depth] = PL_savestack_ix;
+
+ while (PL_savestack_ix + REAP_DESTRUCTOR_SIZE
+                                       <= PL_scopestack[PL_scopestack_ix - 1]) {
+  save_pptr(&ud->dummy);
+ }
+
+ SAVEDESTRUCTOR_X(reap_pop, ud);
+}
+
+#endif /* REAP_H */

Modified: branches/upstream/libindirect-perl/current/t/30-scope.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/t/30-scope.t?rev=59068&op=diff
==============================================================================
--- branches/upstream/libindirect-perl/current/t/30-scope.t (original)
+++ branches/upstream/libindirect-perl/current/t/30-scope.t Tue Jun  8 16:22:58 2010
@@ -1,4 +1,4 @@
-#!perl -T
+#!perl
 
 use strict;
 use warnings;
@@ -6,7 +6,7 @@
 my $tests;
 BEGIN { $tests = 18 }
 
-use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 3;
+use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 5;
 
 BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} }
 
@@ -153,6 +153,7 @@
  is $@, '', 'RT #47902';
 }
 
+# This test may not fail for the old version when ran in taint mode
 {
  my $err = eval <<' SNIP';
   use indirect::TestRequired4::a0;
@@ -167,6 +168,17 @@
 like $err, qr/^Can't locate object method "new" via package "X"/,
            'identifying requires by their eval context pointer is not enough';
 
+{
+ my @w;
+ no indirect hook => sub { push @w, indirect::msg(@_) };
+ use indirect::TestRequired6;
+ indirect::TestRequired6::bar();
+ is_deeply \@w, [ ], 'indirect syntax in sub';
+ @w = ();
+ indirect::TestRequired6::baz();
+ is_deeply \@w, [ ], 'indirect syntax in eval in sub';
+}
+
 __DATA__
 my $a = new P1;
 

Added: branches/upstream/libindirect-perl/current/t/lib/indirect/TestRequired6.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libindirect-perl/current/t/lib/indirect/TestRequired6.pm?rev=59068&op=file
==============================================================================
--- branches/upstream/libindirect-perl/current/t/lib/indirect/TestRequired6.pm (added)
+++ branches/upstream/libindirect-perl/current/t/lib/indirect/TestRequired6.pm Tue Jun  8 16:22:58 2010
@@ -1,0 +1,13 @@
+package indirect::TestRequired6;
+
+sub new { bless {} }
+
+sub bar {
+    my $foo = new indirect::TestRequired6;
+}
+
+sub baz {
+    eval q{my $foo = new indirect::TestRequired6};
+}
+
+1;




More information about the Pkg-perl-cvs-commits mailing list