bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Equivalence class in shell pattern does not work


From: Chet Ramey
Subject: Re: Equivalence class in shell pattern does not work
Date: Mon, 25 Feb 2019 09:37:18 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 2/24/19 10:01 AM, Lukáš Bařinka wrote:

> Bash Version: 5.0
> Patch Level: 2
> Release Status: release
> 
> Description:
> Equivalence class in shell patterns does not work as expected. On the other
> hand, equivalence class does work in regular expressions in bash.
> 
> The problem is in shell patterns inside Extended test [[ ]], globbing and
> the case compound command.

Equivalance classes are hit-or-miss. The only public interface that you can
use outside of libc is strcoll(), and if strcoll doesn't return 0 for
characters in the same equivalence class (to impose a total ordering, for
instance), you're pretty much out of luck.

Bash-5.0 has an autoconf test to determine whether or not fnmatch() will
handle equivalence classes correctly, and compiles in a fallback to it if
it's successful. It does the trick on RHEL 7, for instance, but not on
Mac OS X or Debian.

Since the bash regular expression operators use the system's regexp engine,
which usually has access to this information as part of the libc internals,
it doesn't suffer the same problem.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]