bugfindutils - Bugs: bug #48055, Regex ranges and locales in...

 
 

bug #48055: Regex ranges and locales in gnu-awk regextype

Submitter:  Piotr Jurkiewicz <piotrjurkiewicz>
Submitted:  Mon 30 May 2016 06:12:40 AM UTC
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Works For Me
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.6.0 Fixed Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Wed 30 Nov 2016 05:16:16 AM UTC, comment #2: 

Piotr writes:

I tested this on Debian Stretch (find (GNU findutils) 4.7.0-git) and behavior is correct. So it seems this bug has been fixed.

James Youngman <jay>
Project Administrator
Mon 28 Nov 2016 10:16:23 PM UTC, comment #1: 

Paul Eggert comments:

I can't seem to reproduce the problem on Fedora 24, so perhaps it's been fixed already.

$ ls
a.lower  b.UPPER
$ LC_COLLATE=pl_PL.utf8 find -regextype gnu-awk -regex '.*[a-z]{5}$'
./a.lower
$ LC_COLLATE=pl_PL.utf8 find -regextype gnu-awk -regex '.*[A-Z]{5}$'
./b.UPPER
$ find --version | head -n1
find (GNU findutils) 4.6.0

James Youngman <jay>
Project Administrator
Mon 30 May 2016 06:12:40 AM UTC, original submission:  

Starting with gawk 4.0 the traditional behaviour of regex ranges has been brought back. This means that [a-z] matches only lowercase letters and [A-Z] matches only uppercase letters, regardless of locale and collation being set.

See more: https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html

Can test this with the following command:

$ echo ABC | LC_COLLATE=pl_PL.utf8 gawk '$0 ~ /^[a-b]/' # gawk pre-4.0
ABC

$ echo ABC | LC_COLLATE=pl_PL.utf8 gawk '$0 ~ /^[a-b]/' # gawk 4.0+
[nothing]

Findutils, however, still emulate the old behaviour of gawk in gnu-awk mode. That is, when using certain locales, [a-z] and [A-Z] ranges matches both lowercase and uppercase letters.

Test:

Prepare:

mkdir test
cd test
touch a.lower
touch b.UPPER

Then both commands:

LC_COLLATE=pl_PL.utf8 find -regextype gnu-awk -regex '.*[a-z]{5}$'
LC_COLLATE=pl_PL.utf8 find -regextype gnu-awk -regex '.*[A-Z]{5}$'

returns:

./a.lower
./b.UPPER

instead just one file with appropriate case.

Piotr Jurkiewicz <piotrjurkiewicz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Posted a comment)
  • -email is unavailable- added by piotrjurkiewicz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-30 jay Open/ClosedOpen Closed
    2016-11-30 jay StatusNone Works For Me
        Assigned toNone jay

    Back to the top


    Powered by Savane 3.9