Blame SOURCES/0030-Ticket-54-locale-nl-not-supported-by-collation-plugi.patch

ba46c7
From d30ca340657d858ca416e5c8bc3600607ca49e80 Mon Sep 17 00:00:00 2001
ba46c7
From: Noriko Hosoi <nhosoi@redhat.com>
ba46c7
Date: Wed, 2 Oct 2013 10:56:42 -0700
ba46c7
Subject: [PATCH 30/39] Ticket #54 - locale "nl" not supported by collation plugin
ba46c7
ba46c7
Bug description: In the recent version of ICU, some locales do not
ba46c7
have its specific collator, but are included in the default (root)
ba46c7
locale.  "nl", "en", and "fr" are in the class.  ICU API ucol_open
ba46c7
takes the locale string and returns the collator with the status.
ba46c7
If the locale has no dedicated collator and the root collator is
ba46c7
picked up, status U_USING_DEFAULT_WARNING is returned, which is not
ba46c7
an error.  But collation_indexer_create (collate.c) treats it as an
ba46c7
error and stops the collation.
ba46c7
ba46c7
Fix description: As ICU doc suggests, error checking for ucol_open
ba46c7
is replaced with "(U_SUCCESS(err)", by which the status U_USING_
ba46c7
DEFAULT_WARNING is correctlly handled.
ba46c7
ba46c7
https://fedorahosted.org/389/ticket/54
ba46c7
ba46c7
Reviewed by rmeggins (Thank you, Rich!!)
ba46c7
(cherry picked from commit c8d1cf570882a55329c11d8fba418c575671d131)
ba46c7
(cherry picked from commit 0a45dc28399ab878866d8a23fd289e309a5d73c8)
ba46c7
---
ba46c7
 ldap/servers/plugins/collation/collate.c |    9 +++------
ba46c7
 1 files changed, 3 insertions(+), 6 deletions(-)
ba46c7
ba46c7
diff --git a/ldap/servers/plugins/collation/collate.c b/ldap/servers/plugins/collation/collate.c
ba46c7
index 2a73ee1..a02040f 100644
ba46c7
--- a/ldap/servers/plugins/collation/collate.c
ba46c7
+++ b/ldap/servers/plugins/collation/collate.c
ba46c7
@@ -449,20 +449,17 @@ collation_indexer_create (const char* oid)
ba46c7
 		 * or if we found a fallback one, or if we are happy with
ba46c7
 		 * the default, use it.
ba46c7
 		 */
ba46c7
-		if (err == U_ZERO_ERROR || err == U_USING_FALLBACK_WARNING ||
ba46c7
-		    (err == U_USING_DEFAULT_WARNING && is_default)) {
ba46c7
+		if (U_SUCCESS(err)) {
ba46c7
 		    etc = (collation_indexer_t*) slapi_ch_calloc (1, sizeof (collation_indexer_t));
ba46c7
 		    ix = (indexer_t*) slapi_ch_calloc (1, sizeof (indexer_t));
ba46c7
 		    ucol_setAttribute (coll, UCOL_STRENGTH, profile->strength, &err;;
ba46c7
-		    if (err != U_ZERO_ERROR && err != U_USING_FALLBACK_WARNING
ba46c7
-			&& (err != U_USING_DEFAULT_WARNING || !is_default)) {
ba46c7
+		    if (U_FAILURE(err)) {
ba46c7
 		    	LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: could not "
ba46c7
 				   "set the collator strength for oid %s to %d: err %d\n",
ba46c7
 				   oid, profile->strength, err);
ba46c7
 		    }
ba46c7
 		    ucol_setAttribute (coll, UCOL_DECOMPOSITION_MODE, profile->decomposition, &err;;
ba46c7
-		    if (err != U_ZERO_ERROR && err != U_USING_FALLBACK_WARNING
ba46c7
-			&& (err != U_USING_DEFAULT_WARNING || !is_default)) {
ba46c7
+		    if (U_FAILURE(err)) {
ba46c7
 		    	LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: could not "
ba46c7
 				   "set the collator decomposition mode for oid %s to %d: err %d\n",
ba46c7
 				   oid, profile->decomposition, err);
ba46c7
-- 
ba46c7
1.7.1
ba46c7