[Mono-bugs] [Bug 71111][Nor] New - String Compare on InvariantCulture should not be ordinal.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 8 Jan 2005 19:44:43 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by miguel@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=71111

--- shadow/71111	2005-01-08 19:44:43.000000000 -0500
+++ shadow/71111.tmp.557	2005-01-08 19:44:43.000000000 -0500
@@ -0,0 +1,54 @@
+Bug#: 71111
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: miguel@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: String Compare on InvariantCulture should not be ordinal.
+
+Currently in Mono we assume that `InvariantCulture' string compares
+means `ordinal' compares, as shown by this test on the class libs:
+
+The followin program should print "ok":
+
+using System.Globalization;
+using System.Collections;
+using System;
+
+
+class D {
+	public static void Main ()
+	{
+		int t1 = CultureInfo.InvariantCulture.CompareInfo.Compare ("a", "A", 0);
+		int t2 = CultureInfo.InvariantCulture.CompareInfo.Compare ("a", "A",
+CompareOptions.Ordinal);
+		
+		Console.WriteLine ("Must be < 0 = " + t1);
+		Console.WriteLine ("Must be > 0 = " + t2);
+
+		if (t1 >= 0 || t2 <= 0)
+			Console.WriteLine ("Failed");
+		else
+			Console.WriteLine ("Ok");
+	}
+}
+
+
+This bug can be seen in our regression test suite for mscorlib in
+Collections/ComparerTest/Invariant.
+
+The problem seems to be the code in locales.c, in the routine:
+string_invariant_compare_char.
+
+A FIXME comment is there, we need to find out the rules for ordering
+even for the InvariantCulture