From 3f48829c2939e53c7e961a42d0749765dc076279 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Mon, 27 Sep 2010 07:16:44 +0100 Subject: tr: fix various issues with case conversion This valid translation spec aborted: LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_' This invalid translation spec aborted: LC_ALL=en_US.iso-8859-1 tr '[:upper:] ' '[:lower:]' This was caused by commit 6efd1046, 05-01-2008, "Avoid tr case-conversion failure in some locales" This misaligned conversion spec was allowed: LC_ALL=C tr 'A-Y[:lower:]' 'a-z[:upper:]' This was caused by commit af5d0c36, 21-10-2007, "tr: do not reject an unmatched [:lower:] or [:upper:] in SET1" This misaligned spec was allowed by extending the class: LC_ALL=C tr '[:upper:] ' '[:lower:]' * src/tr.c (validate_case_classes): A new function to check alignment of case conversion classes. Also it adjusts the length of the sets so that locales with different numbers of upper and lower case characters, don't cause issues. (string2_extend): Disallow extending the case conversion class as in the above example. That is locale dependent and most likely not what the user wants. (validate): Do the simple test for "restricted" char classes earlier, so we don't redundantly do more expensive validation. (main): Remove the case class validation, and simplify. * tests/misc/tr-case-class: A new test to test the various alignment and locale issues, associated with case conversion. * tests/misc/tr: Move case conversion tests to new tr-case-class. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fixes. --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 4f1b2b01a..898ee0942 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,11 @@ GNU coreutils NEWS -*- outline -*- tac would perform a double-free when given an input line longer than 16KiB. [bug introduced in coreutils-8.3] + tr now consistently handles case conversion character classes. + In some locales, valid conversion specifications caused tr to abort, + while in all locales, some invalid specifications were undiagnosed. + [bugs introduced in coreutils 6.9.90 and 6.9.92] + ** New features cp now accepts the --attributes-only option to not copy file data, -- cgit v1.2.3-54-g00ecf