helpThe GNU Bourne-Again SHell - Support: sr #108609, In en-US.UTF-8 locale, '*[A-Z]*'...

 
 

sr #108609: In en-US.UTF-8 locale, '*[A-Z]*' matches very oddly

Submitted by:  None
Submitted on:  Thu 03 Jul 2014 02:42:38 AM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Thu 03 Jul 2014 03:13:56 AM UTC, comment #1:

My attempt to use markup formatting appears to have caused the web interface to not display the text, so here is the plain version (minus the first line, which did come through). My apologies if this is redundant.

The demonstration:

$ cat Demo
# shell script
for i in "$@"; do
case "$i" in
[A-Z]) echo "$i has upper case";;
esac
done
$ env - LANG=en_US.UTF-8 ./bash ./Demo a b C y z
b has upper case
C has upper case
y has upper case
z has upper case
$

This was tested with a fresh-compiled build from the latest git tip on 64-bit Ubuntu 14.04. I can (re)produce this behavior in at least Bash 4.3.11 (Ubuntu 14.04), 4.2.47 (Fedora 20), and 4.2.25 (Ubuntu 12.04).

Assuming that it is desirable for '[A-Z]' to match lower case characters at all in this context (I believe that it is a mistake to do so and it certainly doesn't match the behavior of other POSIX-compatible shells), bash should at least match 'a' too.

A mirror image of this bug happens if you use '[a-z]' and test against upper case letters; 'Z' does not match although A-Y do.

Chris Siebenmann <cks>
Thu 03 Jul 2014 02:42:38 AM UTC, original submission:

It's easiest to show this as a demonstration:

Anonymous

 

(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 dennisne
  • -unavailable- added by cks (Posted a comment)
  • -unavailable- added by None (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):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Jul 2014 12:36:52 AM UTCdennisneCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup