[Mono-bugs] [Bug 47692][Nor] Changed - Key duplication in Hashtable.PutImpl

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 18 Aug 2003 07:28:43 -0400 (EDT)


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 lb@lb.ods.org.

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

--- shadow/47692	2003-08-17 23:42:43.000000000 -0400
+++ shadow/47692.tmp.29988	2003-08-18 07:28:43.000000000 -0400
@@ -1,13 +1,13 @@
 Bug#: 47692
 Product: Mono/Class Libraries
 Version: unspecified
 OS: unknown
 OS Details: 
-Status: RESOLVED   
-Resolution: FIXED
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: lb@lb.ods.org               
 QAContact: mono-bugs@ximian.com
@@ -24,6 +24,51 @@
 for details, patch and test case.
 
 ------- Additional Comments From duncan@ximian.com  2003-08-17 23:42 -------
 I got the go-ahead from Miguel and Sergey. Patch applied. Bug FIXED.
 
 Thanks so much for the contribution!
+
+------- Additional Comments From lb@lb.ods.org  2003-08-18 07:28 -------
+The check changed in CVS is the wrong one.
+
+
+The code should be like this:
+
+// if we have not yet found a free entry, and this one is free but not
+the last one in the chain, remember this
+if (freeIndx == -1
+   && entry.key == KeyMarker.Removed
+   && (entry.hashMix & CHAIN_MARKER)!= 0)
+	freeIndx = indx;
+
+// if this is the first free value after the chain (because it's null
+or empty without CHAIN_MARKER), then remember this if we haven't found
+a free entry yet and exit the loop because there are no other elements
+in the chain
+if (entry.key == null ||
+    (entry.key == KeyMarker.Removed
+    && (entry.hashMix & CHAIN_MARKER) == 0)) {
+	if (freeIndx == -1)
+		freeIndx = indx;
+	break;
+}
+
+
+
+
+The new code in CVS instead does this, while not apparently flipping
+the meaning of CHAIN_MARKER in the other code:
+
+if (freeIndx == -1
+    && entry.key == KeyMarker.Removed
+    && (entry.hashMix & CHAIN_MARKER)== 0)
+	freeIndx = indx;
+
+if (entry.key == null ||
+    (entry.key == KeyMarker.Removed
+    && (entry.hashMix & CHAIN_MARKER)!= 0)) {
+	if (freeIndx == -1)
+		freeIndx = indx;
+	break;
+}
+