Bug #17

Dir.glob order spec is invalid.

Added by Sean Bryant 215 days ago. Updated 194 days ago.

Status :Resolved Start :06/04/2008
Priority :Normal Due date :
Assigned to :- % Done :

0%

Category :-
Target version :-

Description

The spec expects a specific ordering but MRI leaves ordering up to readdir(3) which can vary from platform to platform as there's no specification to order entries in a particular order.
For example, OS X will walk the directory alphabetically where as linux will walk the directory based on the kinds of files.

0001-Adding-spec-fix-for-Dir.glob.patch - patch file to comment out Dir glob ordering spec (1.1 KB) Sean Bryant, 06/04/2008 02:41 PM

History

06/04/2008 02:41 PM - Brian Ford

Correct me if I'm mistaken, but this ticket refers to these two specs (#glob and #[] are near aliases):

Dir.[] orders directory-based entries before files when a glob matches both
Dir.glob orders directory-based entries before files when a glob matches both

Does anyone recall why these specs were initially added?

06/04/2008 02:43 PM - Sean Bryant

The history was lost when the specs were moved. So the log is of no use.

06/04/2008 03:21 PM - Vladimir Sizikov

The ordering specs were added by Nick Sieger, since we received users reports on problems with JRuby when running Rails, since some of the Rails code expected ordering as in MRI.

I could dig up a mail archives to post the exact link to the discussion.
To me, these two tests do look like important tests.

06/04/2008 03:32 PM - Vladimir Sizikov

06/05/2008 06:10 PM - Sean Bryant

  • Status changed from New to On Hold

This is on hold until some concrete solution is found to deal with platform specific specifications.
MRI behavior is ad-hoc and sometimes based on an underlying platform for certain operations. This makes it prohibitively difficult write generic specs in certain cases for common operations. Dir.glob is an example of this.

06/06/2008 02:08 PM - Vladimir Sizikov

Got some feedback from beetsweet (Jeremy Kemper) and he said that they typically sort the glob output to eleminate the platform-dependent behavior. But it seems that in that particular case where user reported the a problem, they missed the sort.

So, it does seem that we shouldn't force the order in the RubySpecs then.

06/06/2008 03:48 PM - Brian Ford

Vladimir,

This is good news. :) So, I'm assuming Rails will be fixing this issue in their code?

Would you be able to fix up the specs as appropriate (perhaps this patch is just fine)?

Thanks!

06/25/2008 09:51 AM - Brian Ford

Removed this spec in 0955f3c6.

06/25/2008 09:54 AM - Brian Ford

  • Status changed from On Hold to Resolved

Also available in: Atom PDF