develooper Front page | perl.perl5.porters | Postings from October 2015

Re: [perl #126271] File::Glob issue

Thread Previous | Thread Next
Karl Williamson
October 13, 2015 17:24
Re: [perl #126271] File::Glob issue
Message ID:
On 10/13/2015 03:13 AM, Aristotle Pagaltzis wrote:
> * Karl Williamson <> [2015-10-06 18:05]:
>> One solution I thought of (that Zefram doesn't like) is for F:G to
>> fork a shell if and only if it finds a shell metacharacter. That way
>> the performance wouldn't suffer except in edge cases.
> You brought this up multiple times.

Huh!? Unless I'm losing my mind, this thread is the only time I've ever 
posted on this.  And unless I'm conflating this with something else, the 
only other time I've mentioned this at all was shortly before the 
original post, when I asked a question about it on #irc, and Zefram and 
I quickly concluded it was best handled via email; hence this thread.

I don’t understand the logic behind
> that. What makes you think that the fact that unusual inputs to glob()
> cause the execution of shell commands under PERL_EXTERNAL_GLOB is really
> a feature that needs to be replicated in its other incarnations? Is your
> premise hat the purpose of glob() is not just to perform globbing, but
> also to provide an undocumented poor-usability alternative to system()?
> I’m at a loss. It doesn’t seem plausible that you thought this through
> particularly carefully, but maybe there’s some other consideration that
> drives you in this direction? That would be unlikely (to say the least)
> to change my conclusion – but even so, it would be interesting to know,
> and so far you haven’t stated your premises.
> (I consider this a security hole in PERL_EXTERNAL_GLOB, though the low
> use of that feature means there is only a low-grade vulnerability here.
> Nevertheless it should be closed; security breaches usually result from
> compositions of (mostly) individually-low-grade vulnerabilities.)

And I in turn am at a loss to understand where you're coming from.  My 
original post was because a test was failing on a -DPERL_EXTERNAL_GLOB 
system.  (And there is another test in the suite that also fails)  And I 
didn't know how to proceed.  This feature, like too many others, is 

More complete context of what I said that you quoted above is this

"It is my supposition that the core converting to use File::Glob was for 
performance reasons.  (Perhaps it was to also get more uniform handling 
across platforms.)  Since it's undocumented, perhaps someone could 
enlighten me.  One solution I thought of (that Zefram) doesn't like is 
for F:G to fork a shell if and only if it finds a shell metacharacter. 
That way the performance wouldn't suffer except in edge cases."

So of course I haven't thought this through.  I said I was asking for 
guidance.  And I did state my premise there.  If the purpose of using 
F:G is performance, then use it for inputs where all shells agree, and 
do the fork to get the accustomed behavior only for the other cases. 
And if the purpose isn't for performance, why have -DPERL_EXTERNAL_GLOB 
at all.  It's only use seems to me to get the local behavior instead of 

I do not believe I'm advocating for anything here; I admittedly have too 
little knowledge in the matter to do so.  And I'm certainly not 
persistently advocating for anything.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About