From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 14E7E1F466 for ; Mon, 13 Jan 2020 18:49:56 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9DADB120A16; Tue, 14 Jan 2020 03:49:37 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 6D50E120A14 for ; Tue, 14 Jan 2020 03:49:35 +0900 (JST) Received: by filterdrecv-p3iad2-57f487d66-rgh5v with SMTP id filterdrecv-p3iad2-57f487d66-rgh5v-18-5E1CBBC9-25 2020-01-13 18:49:45.17365668 +0000 UTC m=+2397780.577272705 Received: from herokuapp.com (unknown [52.207.231.224]) by ismtpd0033p1iad2.sendgrid.net (SG) with ESMTP id f6hZHSO_QOuidaCGlzAbZA for ; Mon, 13 Jan 2020 18:49:45.136 +0000 (UTC) Date: Mon, 13 Jan 2020 18:49:45 +0000 (UTC) From: john@hawthorn.email Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72491 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 8709 X-Redmine-Issue-Author: tommorris X-Redmine-Sender: jhawthorn X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?Moz+ppbnykU3GRKLzmq7AlLQP+9K3W03NvRziaqjTC7s3V3MT8sTzHRJTF7eD1?= =?us-ascii?Q?qAqcU0EacvPxQMdhjf+sGx8icchHOTTCZCaE134?= =?us-ascii?Q?aN5dLqZzTaoLN=2FLNND7EU5g3KQzhTXg5hgQKGXY?= =?us-ascii?Q?uOf0Cljx=2FOLwcQBDHtXNgEBvnUx2M2s=2FjjY7TKV?= =?us-ascii?Q?NVM=2FiVK8KQJMKZuDMxyoIr4Rn0kdwGV+wLfoyHx?= =?us-ascii?Q?rhR=2F2h6KXGKFMg9HE=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96828 Subject: [ruby-core:96828] [Ruby master Feature#8709] Dir.glob should return sorted file list X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #8709 has been updated by jhawthorn (John Hawthorn). One potential issue with this is that though globs which scanned directories (ex. `Dir.glob("foo/*")`) would return results in an inconsistent order, globs which used purely brace expansion (ex. `Dir.glob("foo/{a,b,c,d}")`) would return values predictably in the order listed. Rails versions prior to 6.0 unfortunately relied on this behaviour (6.0+ in *most* cases doesn't and does sorting manually). It probably shouldn't have relied on it, but it did, and I fear other libraries or tools may have done the same. We could possibly work around that by sorting when reading directory entries rather than sorting the full result, but that's more complicated to implement and would be hard to document as an exact behaviour developers can expect/rely upon. ---------------------------------------- Feature #8709: Dir.glob should return sorted file list https://bugs.ruby-lang.org/issues/8709#change-83826 * 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/