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

[perl #121566] File::Glob::NO_CASE doesn't have effect without metacharacters

Thread Previous
From:
James E Keenan via RT
Date:
September 24, 2014 01:18
Subject:
[perl #121566] File::Glob::NO_CASE doesn't have effect without metacharacters
Message ID:
rt-4.0.18-2011-1411521497-47.121566-15-0@perl.org
On Fri Apr 04 07:03:47 2014, ikegami@adaelis.com wrote:
> On Wed, Apr 2, 2014 at 4:47 PM, Smylers <Smylers@stripey.com> wrote:
> 
> > Eric Brine writes:
> >
> > > On Wed, Apr 2, 2014 at 11:29 AM, Smylers <perlbug-followup@perl.org>
> > wrote:
> > >
> > > > File::Glob has a GLOB_NOCASE option, documented as making bsd_glob
> > > > treat case differences as not significant.
> > >
> > > Treats **file names** as case insensitive.
> >
> > Sorry, I don't follow. When comparing a filename with a pattern, surely
> > it's the _comparison_ that's actually case-insensitive (or not)? I don't
> > understand the distinction in it being specifically the filename that's
> > marked as being case-insensitive.
> >
> 
> Glob is a string generator. Not all patterns results in comparisons.
> 
> 
> > Even without any metacharacters, it appears only to be returning files
> > that actually exist. Compare this:
> >
> >   $ ./perl -Ilib -MFile::Glob=bsd_glob,GLOB_NOCASE -E 'say foreach
> > bsd_glob "makefile", GLOB_NOCASE'
> >   makefile
> >
> > With this, which yields no output:
> >
> >   $ ./perl -Ilib -MFile::Glob=bsd_glob,GLOB_NOCASE -E 'say foreach
> > bsd_glob "no_such_file", GLOB_NOCASE'
> >
> 
> What? The case GLOB_NOCASE present is very inconsistent with GLOB_NOCASE
> absent.
> 
> $ perl -MFile::Glob=bsd_glob,GLOB_NOCASE -E 'say for bsd_glob "missing",
> GLOB_NOCASE'
> 
> $ perl -MFile::Glob=bsd_glob,GLOB_NOCASE -E 'say for bsd_glob "missing"'
> missing
> 
> Ok, I agree there's a bug here. Specifically, these two should return the
> same result:
> 
> $ perl -MFile::Glob=bsd_glob,GLOB_NOCASE -E 'say for bsd_glob
> "mooooooooooo", GLOB_NOCASE'
> 
> $ perl -MFile::Glob=bsd_glob,GLOB_NOCASE -E 'say for bsd_glob
> "MoooOOOooooo", GLOB_NOCASE'
> MoooOOOooooo
> 
> I don't know whether they should both return "mooooooooooo" (no file system
> check like without GLOB_NOCASE) or MoooOOOooooo (Make the existing file
> system check case in-sensitive). I can't see any drawbacks to the latter.

Discussion in this RT petered out about 5-1/2 months ago.

Suggestions as to how to move forward are welcome.

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

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

Thread Previous


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