From 6efd10462d8103208f4575f0b5edddf841c7d87c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 5 Jan 2008 23:55:01 +0100 Subject: Avoid tr case-conversion failure in some locales. * src/tr.c (skip_construct): New function. (main): When processing a pair of case-converting classes, don't iterate through the elements of each [:upper:] or [:lower:] class. Reported by Gerald Pfeifer in . * tests/tr/Test.pm [tolower-F]: New test for the above fix. [upcase-xtra, dncase-xtra]: New tests, for a related code path. * NEWS: Mention the tr bug fix. --- tests/tr/Test.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/tr') diff --git a/tests/tr/Test.pm b/tests/tr/Test.pm index 7b25a156e..cf7021397 100644 --- a/tests/tr/Test.pm +++ b/tests/tr/Test.pm @@ -139,8 +139,20 @@ my @tv = ( # Up to coreutils-6.9, tr rejected an unmatched [:lower:] or [:upper:] in SET1. ['s1-lower', q|'[:lower:]' '[.*]'|, '#$%123abcABC', '#$%123...ABC', 0], ['s1-upper', q|'[:upper:]' '[.*]'|, '#$%123abcABC', '#$%123abc...', 0], + +# Up to coreutils-6.9.91, this would fail with the diagnostic: +# tr: misaligned [:upper:] and/or [:lower:] construct +# with LC_CTYPE=en_US.iso88591. +['tolower-F',q|'[:upper:]' '[:lower:]'|, 'A', 'a', 0], + +# When doing a case-converting translation with something after the +# [:upper:] and [:lower:] elements, ensure that tr honors the following byte. +['upcase-xtra',q|'[:lower:].' '[:upper:]x'|, 'abc.', 'ABCx', 0], +['dncase-xtra',q|'[:upper:].' '[:lower:]x'|, 'ABC.', 'abcx', 0], ); +$Test::env{'tolower-F'} = ['LC_CTYPE=en_US.iso88591']; + sub test_vector { my $t; -- cgit v1.2.3-54-g00ecf