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

 
 

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

Submitted by:  Piotr Jurkiewicz <piotrjurkiewicz>
Submitted on:  Mon 30 May 2016 06:12:40 AM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: Wrong resultStatus: Works For Me
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Open/Closed: Closed
Release: 4.6.0Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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 AdministratorIn charge of this item.
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 AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 30 Nov 2016 05:16:28 AM UTCjayOpen/ClosedOpen=>Closed
    Wed 30 Nov 2016 05:16:16 AM UTCjayStatusNone=>Works For Me
      Assigned toNone=>jay

    Back to the top


    Powered by Savane 3.1-cleanup1