From nobody Fri Apr 21 19:04:29 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q33qY23pHz46l4n for ; Fri, 21 Apr 2023 19:04:41 +0000 (UTC) (envelope-from jamie@catflap.org) Received: from donotpassgo.dyslexicfish.net (donotpassgo.dyslexicfish.net [IPv6:2001:19f0:7400:8808:123::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4Q33qX6pk6z3spQ for ; Fri, 21 Apr 2023 19:04:40 +0000 (UTC) (envelope-from jamie@catflap.org) Authentication-Results: mx1.freebsd.org; none X-Catflap-Envelope-From: X-Catflap-Envelope-To: freebsd-current@FreeBSD.org Received: from donotpassgo.dyslexicfish.net (donotpassgo.dyslexicfish.net [209.250.224.51]) by donotpassgo.dyslexicfish.net (8.14.5/8.14.5) with ESMTP id 33LJ4T8l044066; Fri, 21 Apr 2023 20:04:29 +0100 (BST) (envelope-from jamie@donotpassgo.dyslexicfish.net) Received: (from jamie@localhost) by donotpassgo.dyslexicfish.net (8.14.5/8.14.5/Submit) id 33LJ4TA3044065; Fri, 21 Apr 2023 20:04:29 +0100 (BST) (envelope-from jamie) From: Jamie Landeg-Jones Message-Id: <202304211904.33LJ4TA3044065@donotpassgo.dyslexicfish.net> Date: Fri, 21 Apr 2023 20:04:29 +0100 Organization: Dyslexic Fish To: yuri@aetern.org, freebsd-current@FreeBSD.org Subject: Re: find(1): I18N gone wild ? References: <3e473603-f384-f176-e7cb-03409e16ec9c@aetern.org> In-Reply-To: User-Agent: Heirloom mailx 12.4 7/29/08 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (donotpassgo.dyslexicfish.net [209.250.224.51]); Fri, 21 Apr 2023 20:04:29 +0100 (BST) X-Rspamd-Queue-Id: 4Q33qX6pk6z3spQ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:20473, ipnet:2001:19f0:7400::/38, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N Yuri wrote: > > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13 > > > > ...which in turn refers to the following link for bracket expressions: > > > > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05 > > > > Why we don't support all of that is different story. > > A bit more on this; first link applies both to find(1) and fnmatch(3), > and find uses fnmatch() internally (which is good), but even the > function that processes bracket expressions is called rangematch() and > that's really all it does ignoring other bracket expression rules: > > https://cgit.freebsd.org/src/tree/lib/libc/gen/fnmatch.c#n234 > > So to "fix" find we just need to implement the bracket expressions > properly in fnmatch(). No. find "-name" works with GLOBs not regex. The functionality you are talking about, and the page you quoted refer to regular expressions. For that, you use find "-regex" - note that the regex is assumed anchored, so: $ LANG=en_US.UTF-8 find -E /etc/rc.d -regex '.*[[:upper:]]+' -print /etc/rc.d/NETWORKING /etc/rc.d/FILESYSTEMS /etc/rc.d/SERVERS /etc/rc.d/DAEMON /etc/rc.d/LOGIN $ Jamie