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

[perl #30553] File::Glob behaviour using GLOB_BRACE | GLOB_NOCHECK

Thread Next
From:
James E Keenan via RT
Date:
September 29, 2012 19:06
Subject:
[perl #30553] File::Glob behaviour using GLOB_BRACE | GLOB_NOCHECK
Message ID:
rt-3.6.HEAD-11172-1348970761-1990.30553-15-0@perl.org
On Thu Jul 01 03:59:50 2004, j.g.karssenberg@student.utwente.nl wrote:
> 
> This is a bug report for perl from pardus@cpan,
> generated with the help of perlbug 1.34 running under perl v5.8.2.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> The following script:
> 
>   use File::Glob ':glob';
> 
>   my @test = (
>     '{random string}',
>     '\\{random string\\}',
>     '{random,string}'
>   );
> 
>   for (@test) {
>     print "glob: $_ ==> ";
>     print join ', ', bsd_glob($_, GLOB_BRACE | GLOB_NOCHECK);
>     print "\n";
>   }
> 
> Produces the following output:
> 
>   glob: {random string} ==> random string
>   glob: \{random string\} ==> \random string\
>   glob: {random,string} ==> random, string
> 
> I believe this to be wrong, because since I have no file called 'random
> string' and the GLOB_NOCHECK option is in effect the _original_ pattern
> should be returned. But I realise some people might consider it a
> feature. The point is that it results in unexpected behaviour, I
> understand how this "expansion" happens, but I'm afraid my users will
> not.
> 
> I noticed a similar behaviour in bash ( suggesting that this is a
> feature of the underlying C-library (?) ) but there it only happens when
> there is at least one ',' between the braces. This is an arbitrary rule,
> but feels all ready more heuristic then the current behaviour of
> File::Glob.
> 
> Please let me know if this is considered a feature instead of a bug, in
> that case I will write a high-level wrapper/workaround and put it on
> cpan as a subclass of File::Glob.
> 


There was a fair amount of back-and-forth about this eight years ago. 
My sense from Rafael's comments is that he thought no change from
current behavior was needed.

Is there anyone who could review the issues and make a recommendation
either for a behavior change, for a documentation change or for closing
the ticket?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=30553

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