[ruby-core:96851] [Ruby master Feature#8709] Dir.glob should return sorted file list
From:
eregontp@...
Date:
2020-01-14 10:44:38 UTC
List:
ruby-core #96851
Issue #8709 has been updated by Eregon (Benoit Daloze).
Even C's glob(3) is sorted (by default), as @bmwiedemann said:
```
$ man 3 glob
...
GLOB_NOSORT
Don't sort the returned pathnames. The only reason to do this is to save processing time. By default, the returned path‐
names are sorted.
```
----------------------------------------
Feature #8709: Dir.glob should return sorted file list
https://bugs.ruby-lang.org/issues/8709#change-83856
* Author: tommorris (Tom Morris)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
On OS X, Dir.glob and Dir[] return an ordered list of files.
On Ubuntu Linux, they do not and one must manually sort them.
Returning a list of files that isn't in order fails the Principle of Least Astonishment.
I attach a unit test to demonstrate ideal behaviour.
---Files--------------------------------
globtest.rb (454 Bytes)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>