In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/cfe65c2e3208a5627c838a187143249612d21576?hp=a71a1afb2287c191e69669788abc7bd83dc909a1>

- Log -----------------------------------------------------------------
commit cfe65c2e3208a5627c838a187143249612d21576
Author: Father Chrysostomos <[email protected]>
Date:   Thu Sep 20 14:48:48 2012 -0700

    Increase $File::Glob::VERSION to 1.18

M       ext/File-Glob/Glob.pm

commit a6636b43dc409e4b49f369c18fedd34332fdb9ab
Author: Father Chrysostomos <[email protected]>
Date:   Thu Sep 20 14:25:38 2012 -0700

    [perl #114984] Glob.xs: Extend stack when returning
    
    If a pattern passed to File::Glob consists of a space-separated list
    of patterns, the stack will only be extended by doglob() enough for
    the list returned by each subpattern.  So iterate() needs to extend
    the stack before copying the list of files from an AV to the stack.
    
    This fixes a regression introduced in 5.16.0.

M       MANIFEST
M       ext/File-Glob/Glob.xs
A       ext/File-Glob/t/rt114984.t
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                   |    1 +
 ext/File-Glob/Glob.pm      |    2 +-
 ext/File-Glob/Glob.xs      |    1 +
 ext/File-Glob/t/rt114984.t |   25 +++++++++++++++++++++++++
 4 files changed, 28 insertions(+), 1 deletions(-)
 create mode 100644 ext/File-Glob/t/rt114984.t

diff --git a/MANIFEST b/MANIFEST
index a7935fc..cceb00e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3748,6 +3748,7 @@ ext/File-Glob/t/basic.t           See if File::Glob works
 ext/File-Glob/t/case.t         See if File::Glob works
 ext/File-Glob/t/global.t       See if File::Glob works
 ext/File-Glob/TODO             File::Glob extension todo list
+ext/File-Glob/t/rt114984.t     See if File::Glob works
 ext/File-Glob/t/taint.t                See if File::Glob works
 ext/GDBM_File/GDBM_File.pm     GDBM extension Perl module
 ext/GDBM_File/GDBM_File.xs     GDBM extension external subroutines
diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm
index cd15922..89dd420 100644
--- a/ext/File-Glob/Glob.pm
+++ b/ext/File-Glob/Glob.pm
@@ -38,7 +38,7 @@ pop @{$EXPORT_TAGS{bsd_glob}}; # no "glob"
 
 @EXPORT_OK   = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob');
 
-$VERSION = '1.17';
+$VERSION = '1.18';
 
 sub import {
     require Exporter;
diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs
index 3ea0590..d74e7a4 100644
--- a/ext/File-Glob/Glob.xs
+++ b/ext/File-Glob/Glob.xs
@@ -93,6 +93,7 @@ iterate(pTHX_ bool(*globber)(pTHX_ AV *entries, SV *patsv))
     /* chuck it all out, quick or slow */
     if (gimme == G_ARRAY) {
        if (!on_stack) {
+           EXTEND(SP, AvFILLp(entries)+1);
            Copy(AvARRAY(entries), SP+1, AvFILLp(entries)+1, SV *);
            SP += AvFILLp(entries)+1;
        }
diff --git a/ext/File-Glob/t/rt114984.t b/ext/File-Glob/t/rt114984.t
new file mode 100644
index 0000000..4229c6b
--- /dev/null
+++ b/ext/File-Glob/t/rt114984.t
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+use v5.16.0;
+use File::Temp 'tempdir';
+use File::Spec::Functions;
+use Test::More tests => 1;
+
+my @md = (1..305);
+my @mp = (1000..1205);
+
+my $path = tempdir uc cleanup => 1;
+
+foreach (@md) {
+    open(my $f, ">", catfile $path, "md_$_.dat");
+    close $f;
+}
+
+foreach (@mp) {
+    open(my $f, ">", catfile $path, "mp_$_.dat");
+    close $f;
+}
+my @b = glob(qq{$path/mp_[0123456789]*.dat
+                $path/md_[0123456789]*.dat});
+is scalar(@b), @md+@mp,
+    'File::Glob extends the stack when returning a long list';

--
Perl5 Master Repository

Reply via email to