develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #119897] glob in threads is broken in perl5.18

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
September 25, 2013 12:44
Subject:
Re: [perl #119897] glob in threads is broken in perl5.18
Message ID:
CA+vYcVygiemPuGnr4wDkjTMvnu3AabCN=dJZp7X5gpW=jjrfng@mail.gmail.com
On Tue, Sep 24, 2013 at 8:32 AM, Brian Fraser <fraserbn@gmail.com> wrote:
> On Sat, Sep 21, 2013 at 11:47 PM, Craig A. Berry <craig.a.berry@gmail.com>
> wrote:
>>
>> On Sat, Sep 21, 2013 at 12:51 PM, Father Chrysostomos via RT
>> <perlbug-followup@perl.org> wrote:
>> > On Sat Sep 21 07:40:33 2013, Hugmeir wrote:
>>
>> I have done a smoke run of smoke-me/hugmeir/dup_glob_state, results
>> available at:
>>
>>
>> <http://www.nntp.perl.org/group/perl.daily-build.reports/2013/09/msg151124.html>

> Could I ask you to fetch the branch again and try that test?

Here ha go:

<http://www.nntp.perl.org/group/perl.daily-build.reports/2013/09/msg151317.html>

The test failure I think you're interested in looks like:

$ perl  ../ext/File-Glob/t/threads.t
not ok 1
#   Failed test at ../ext/File-Glob/t/threads.t line 44.
#          got: '1_file.'
#     expected: '1_file'
not ok 2 - glob() state is cloned for new threads
#   Failed test 'glob() state is cloned for new threads'
#   at ../ext/File-Glob/t/threads.t line 48.
#     Structures begin differing at:
#          $got->[0] = '2_file.'
#     $expected->[0] = '2_file'
not ok 3 - ..and for new threads inside threads
#   Failed test '..and for new threads inside threads'
#   at ../ext/File-Glob/t/threads.t line 59.
#     Structures begin differing at:
#          $got->[0] = '2_file.'
#     $expected->[0] = '2_file'
not ok 4 - state doesn't leak from threads
#   Failed test 'state doesn't leak from threads'
#   at ../ext/File-Glob/t/threads.t line 66.
#          got: '2_file.'
#     expected: '2_file'
1..4
# Looks like you failed 4 tests of 4.
%SYSTEM-F-ABORT, abort
$

And the gotcha is that on VMS, all files have extensions, even those
that don't :-).  In other words, the trailing dot indicates a
zero-length extension.  The path of least resistance is to just put an
explicit extension on those files:

--- ext/File-Glob/t/threads.t;-0 2013-09-22 05:26:48 -0500
+++ ext/File-Glob/t/threads.t 2013-09-25 07:08:29 -0500
@@ -28,7 +28,7 @@ use File::Glob qw(csh_glob);
 my($dir) = tempdir(CLEANUP => 1)
     or die "Could not create temporary directory";

-my @temp_files = qw(1_file 2_file 3_file);
+my @temp_files = qw(1_file.tmp 2_file.tmp 3_file.tmp);
 for my $file (@temp_files) {
     open my $fh, ">", File::Spec->catfile($dir, $file)
         or die "Could not create file $dir/$file: $!";
[end]

which gets the test to pass:

$ perl  ../ext/File-Glob/t/threads.t
ok 1
ok 2 - glob() state is cloned for new threads
ok 3 - ..and for new threads inside threads
ok 4 - state doesn't leak from threads
1..4

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About