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:
Brian Fraser
Date:
September 22, 2013 09:27
Subject:
Re: [perl #119897] glob in threads is broken in perl5.18
Message ID:
CA+nL+nZXOs27mzZJGe3Sihp5ET6_D8qnuoyv6FngUR8N37hWeA@mail.gmail.com
On Sat, Sep 21, 2013 at 10:56 AM, Father Chrysostomos via RT <
perlbug-followup@perl.org> wrote:
> On Fri Sep 20 23:45:43 2013, Hugmeir wrote:
> > On Sat, Sep 21, 2013 at 12:19 AM, Father Chrysostomos via RT <
> > perlbug-followup@perl.org> wrote:
> >
> > > On Fri Sep 20 18:05:44 2013, Hugmeir wrote:
> > > > meanwhile, the paradigm in the few CPAN modules that do this[*] is
> > "grab
> > > > the interpreter during BOOT, use that to construct a fake
> > > CLONE_PARAMS, and
> > > > then replace the interpreter with aTHX after MY_CXT_CLONE"
> > > > Which, on top of the previous patch, becomes this:
> > >
> > > It has often bothered me that a CLONE method in pure Perl can’t
> > really
> > > access both interpreters. I have known about CLONE for a long time,
> > but
> > > had never actually seen it used (or bothered looking).
> > >
> > > If what you have below works, and works reliably (it looks fine to
> > me),
> > > I say go for it.
> > >
> >
> > I wasn't sure if the new tests would work on VMS -- most of the other
> > glob
> > test files have special cases for it -- so I've pushed this as
> > smoke-me/hugmeir/dup_glob_state
>
> Your test assumes that the output will be sorted, but does not even use
> File::Glob on VMS. I don’t know whether the default glob on VMS
> produces sorted output, and whether you need to sort it. Alternatively,
> just ‘use File::Glob "glob"’ explicitly, and bypass the globhook
> mechanism (which VMS ignores) altogether.
>
Actually. I've hit a bit of a snag here. How come bsd_glob() doesn't keep
state?
use 5.010;
use File::Glob qw(bsd_glob csh_glob);
say "Default glob:";
say scalar glob("*") for 1..3;
say "\nbsd_glob:";
say scalar bsd_glob("*") for 1..3;
say "\ncsh_glob:";
say scalar csh_glob("*") for 1..3;
__END__
Default glob:
base
benchmark
bigmem
bsd_glob:
x2p
x2p
x2p
csh_glob:
base
benchmark
bigmem
Also, by doing a 'use File::Glob qw(:bsd_glob)', CORE::glob gets replaced
with bsd_glob_override(), which does keep state. So bsd_glob() sometimes
keeps state?
I can work around this by using csh_glob in those tests, which both keeps
state and returns the results sorted alphabetically, but I don't quite grok
how this is all supposed to work.
>
> Concerning your earlier Test::More comment and my response, I don’t
> think we actually need to load threads before Test::More if all the
> tests will be coming from one thread.
>
> >
> >
> > >
> > > Is it possible to write this in a way that is binary-compatible (for
> > > 5.16 and 5.18)? I believe the fact that the struct below is not
> > public
> > > makes it safe to change it like that.
> > >
> >
> > This I do not know.
> > (I can't find a definition of binary (in)?compatibility perlpolicy or
> > other
> > pods)
>
> As long as XS extensions compiled with 5.18.[10] continue to work with
> 5.18.2, we preserve binary compatibility. With File::Glob, I don’t
> think we actually have anything to worry about. I just brought it up
> because I want to backport the change.
>
> BTW, we should probably add a new API to perl for registering clone
> handlers.
>
> --
>
> Father Chrysostomos
>
>
> ---
> via perlbug: queue: perl5 status: open
> https://rt.perl.org:443/rt3/Ticket/Display.html?id=119897
>
Thread Previous
|
Thread Next