From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3954 invoked by alias); 4 Jun 2017 00:07:13 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41209 Received: (qmail 5394 invoked from network); 4 Jun 2017 00:07:13 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f49.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.49):SA:0(0.5/5.0):. Processed in 1.47846 secs); 04 Jun 2017 00:07:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.49 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=l9mKpheGUv3GE8NCl0GJGaAFxQr8kbm7nH35ApdkACg=; b=xdItNe+1Lao5oAGrax8FVeXptBEW4bS9Gmf81jGq9iQ7CJQMED8LerdcK4znMODW1I H+qqqqJtlkHO571JEvxZN4HVs8s+qfk1M2yN24QfiUQjzNclsO362GSMZXW4lP6LGKfH N7nAqa7qVF0bBRzGAZs1V3WemAHmububNYD+n9CDwzZf62q1DOPgIBES1qzi1qZY31hk cglAOUZGb4qg8PMqXweMdKY0PywodqHq6NpaKEuneYxgaN7jyIBb54OOiOpH3sgMZllV 5K4bZmQPh8QF9G0NtrYg5rjOP9AxtxjhWroEpn6quiyPBsVLfXDcb9OM8vb2ew8HgTUI 8AtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=l9mKpheGUv3GE8NCl0GJGaAFxQr8kbm7nH35ApdkACg=; b=g8k52hNMJeq43TyjqYFyMal8tjk0Iw+TzF9DkFZdKCJZH3hQq+zDT2sv0Z9TJ0FeaU DGgJW307NzsYxDqUGRhvzs54Fv8pMo+mXsyiD/d+UxZ0gS9qxmMerLIUph9BP3Rl857p FbYeCB2pVTVfg8U2DvvrQgm3l/P8hlRxGvO96pGNMcWr3gLax1+60m31DkCG9zK9/euQ BOw3LoMXnZOIjn7UYQuNDi6st1pzZCRfLvPgLcSZrXRyoLISFQ7tAf/vxBw7rQXCyNVc 9zIAvR9LqGqA2heCWMUfqyD4tFFZ4SEV4G6IK+HTPNZxCFll8jemGmD2rfmTxyqSIFed ao9A== X-Gm-Message-State: AODbwcDdmA9ty5rCvX6frXBB6arNnaGJv42cBIhCWgNXGDL/eJRUHz11 Yd9SFdJ65oN07F8RTR4= X-Received: by 10.31.195.196 with SMTP id t187mr1490374vkf.151.1496534823339; Sat, 03 Jun 2017 17:07:03 -0700 (PDT) From: Bart Schaefer Message-Id: <170603170724.ZM15645@torch.brasslantern.com> Date: Sat, 3 Jun 2017 17:07:24 -0700 In-Reply-To: <20170603211645.GA17785@chaz.gmail.com> Comments: In reply to Stephane Chazelas "Re: Surprising behaviour with numeric glob sort" (Jun 3, 10:16pm) References: <20170531212453.GA31563@chaz.gmail.com> <170601152943.ZM4783@torch.brasslantern.com> <20170602090332.GA6574@chaz.gmail.com> <170602161905.ZM10488@torch.brasslantern.com> <20170603211645.GA17785@chaz.gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: Surprising behaviour with numeric glob sort MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 3, 10:16pm, Stephane Chazelas wrote: } } When comparing "zsh-3" with "zsh2", we compare the non-numeric } prefix: "zsh-" and "zsh". And already, at that point, "zsh" is } less than "zsh-", so we stop here (zsh2 < zsh-3) Explain how to do that without either re-implementing strcoll(), copying the input strings into temporaries, or requiring the input strings to be writable so that we can plug in temporary '\0' bytes after each non-numeric substring, and at that point we can discuss using this algorithm. Otherwise it's going to be unusuably slow for any moderately large input set. Otherwise you're describing what's already done: strcoll() is used, and then the non-numeric prefixes of the two strings are compared, and only if the non-numeric parts are identical is numeric comparison applied. (Of course this is already slightly wrong, because it means the non-numeric parts have to be *identical* not merely collated the same, but to fix that we're back to "re-implement strcoll()".)