X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4CFAD97B.3060101@redhat.com> Date: Sat, 04 Dec 2010 17:14:51 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Problem with Bash regex test case sensitivity References: <4CF96F70 DOT 3090507 AT veritech DOT com> <4CF9BA08 DOT 8060703 AT redhat DOT com> <20101204150642 DOT GA26471 AT calimero DOT vinschen DOT de> <4CFAB766 DOT 9030900 AT veritech DOT com> In-Reply-To: <4CFAB766.9030900@veritech.com> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigCBCFEC5171DF67FD411A5907" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------enigCBCFEC5171DF67FD411A5907 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/04/2010 02:49 PM, Lee Rothstein wrote: > Therefore, instead of using '[A-Z]' to represent caps, I should > have used (?) the Posixly Correct, '[:upper:]'. POSIX 2001 and 2008 says that [A-Z] when used as a glob or as a regex is defined _only_ in the C locale; in all other locales, it's behavior is unspecified. Meanwhile, [[:upper:]] (note the double [ and ]) is well-defined in all locales (the next version of POSIX will make it more obvious that [:upper:] might be treated as either [:epru] or [[:upper:]], if not outright rejected as an error). It all stems from the earlier POSIX 1992, which required [A-Z] to match collation order in all locales. POSIX 2001 withdrew that requirement based on how many people it confused, but the damage was already done - it is no longer portable because of people that literally implemented the older requirement (bash included). Now, what would be really nice is if all implementations treated unspecified behavior for [A-Z] as meaning a sane synonym for [[:upper:]], but that's not going to happen any time soon. --=20 Eric Blake eblake AT redhat DOT com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigCBCFEC5171DF67FD411A5907 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJM+tl7AAoJEKeha0olJ0Nq9ZQIAK3Laj1u99yCWWNSGpLmvbPS BKE4F9b4J16i9ew0XWEdlS/+fkkOSO4G2LIzVv8BF366oP0gRPjLXz5e1bnD57il uS0GZ0zXI5AUyNfhdz5ZYEJThkxqKo6OLjvkI3OtA2RGuBchaJC80ej/YVT2J+Ap eCKC3ykBpD6uA6atfMbxSGxn17We+Hlcl1YBbR67HDW5z5d1ovY/0N/5EBI3aFIt PlnVUup7jgzscfrFj3og8NzRUBxgvfFilL59oXGqiZRWrc9hXTjCjwp3/gHYswXQ d8QNc+/5gNAASZxPS3eE15gb1+5OHr/1Lr4xv+kdlWonNPUVMfsUy1dgyNm1brg= =CYQf -----END PGP SIGNATURE----- --------------enigCBCFEC5171DF67FD411A5907--