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

[perl #119785] bsd_glob does not sort case-sensitively

Thread Previous
From:
James E Keenan via RT
Date:
December 12, 2013 02:25
Subject:
[perl #119785] bsd_glob does not sort case-sensitively
Message ID:
rt-4.0.18-6158-1386815150-171.119785-15-0@perl.org
On Mon Sep 16 16:21:38 2013, jkeenan wrote:
> On Mon Sep 16 15:43:36 2013, jrw32982@yahoo.com wrote:
> > > Jim Keenan wrote:
> > > I think we should ask:
> > >
> > > 1. Is this behavior expected and correct?
> > >
> > > 2. If it is, what changes do we have to make in 'ext/File-
> >    Glob/Glob.pm'
> > > so that a user of File::Glob will have the correct expectations?
> > 
> > Now that I finally understand the File::Glob doc, I think the results
> >    are correct (i.e. they match the documentation).
> > 
> > 1) bsd_glob(PATTERN) === bsd_glob(PATTERN, GLOB_CSH)
> > 
> > 
> > Relative to sorting,�
> > 2) GLOB_CSH === GLOB_ALPHASORT
> > 
> > GLOB_NOCASE affects the interpretation of PATTERN, so is not
> >    applicable in this case, but when it is specified, it turns off the
> >    default use of GLOB_CSH, thereby reverting to the default mentioned
> >    in the GLOB_NOSORT paragraph, namely ASCII sort rather than
> >    ALPHASORT.
> > 
> > GLOB_NOSORT returns a more or less randomly ordered list (depending on
> >    the physical order of the entries in the directory.� You're getting
> >    the result you got because of the order you created the files.� If
> >    it had been different, you would have gotten a different order of
> >    your results.
> > 
> > GLOB_BRACE is similar to GLOB_NOCASE above, in that it affects the
> >    interpretation of PATTERN, but it has the side effect of turning
> >    off the default use of GLOB_CSH causing the behavior to revert to
> >    ASCII sort.
> > 
> > I don't know if you can make any changes to the code of File::Glob
> >    without breaking backward compatibility.
> 
> Well, *I*, for one, am not attempting any changes in File::Glob's code.
>  I don't think there's any cause for that and, in any event, that's
> outside my expertise.  Even if we did want to make any code changes,
> those changes would only apply to blead and 5.20; we wouldn't attempt
> any backward-compatibility.
> 
> > I think a doc change is
> >    needed to clarify that:
> > 
> > Here's the crux of the issue:� With only one argument, the default is
> >    exactly as if GLOB_CSH was used.� This is mentioned under the
> >    bsd_glob() function description in the 5.16 and 5.18 documentation,
> >    but it is not mentioned in older versions of the documentation.
> >    Especially, it is not mentioned in the 5.18 documentation, in the
> >    POSIX FLAGS section, that the flag defaults are *only* in effect if
> >    **the second argument is specified**.� The word "default" is used a
> >    couple of times in the POSIX FLAGS section, but those are only the
> >    defaults if the second argument is specified!� It took me a long
> >    time to figure that out.
> > 
> 
> I can look into this -- but if others wish to comment on File::Glob's
> *documentation*, they should speak now.
> 
> > 
> > As a side note, I wish there were a tag that would export bsd_glob()
> ...
> 
> In order to keep the discussion focused and the ticket potentially
> closable, I'm going to ask that if you want any changes in File::Glob's
> code/behavior for 5.20+, you file a new perlbug with that request.
> 
> >[snip] 
> > 
> > The bottom line is
> >    that I've decided to avoid File::Glob (and glob(), etc) and use my
> >    own hand-rolled function, since I have to support code on perl
> >    5.8.8.
> > 
> 
> Perl 5.8.8 is long out-of-support, so if you need to support File::Glob,
> glob() or anything else on that version, you'll have to do a lot of
> hand-rollling :-)
> 

There has been no further correspondence in this ticket for nearly three months.  I'm closing it now.  Please open a new ticket with a patch if you want, say, changes in the File::Glob documentation.

Thank you very much.
Jim Keenan

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

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