sks-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Proper case handling for words index (was: [Sks-devel] key index


From: Kim Minh Kaplan
Subject: [PATCH] Proper case handling for words index (was: [Sks-devel] key indexing weirdness)
Date: Fri, 07 Aug 2009 05:54:06 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Jonathon Weiss:

> Hi All,
>
> It was pointed out to me that searching for the full name associated
> with key 0xF5832DD7C85CC5AD did not find the key, though searching for
> just the first name did.  Actually searching for just the last name
> seems to fail too.  The random 2 other SKS servers I checked seem to
> have the same problem too.  Any idea what would cause this?

It is a bug in SKS: during indexing it does not properly handle
uppercases in the last word of the user ID.  Here is the fix that is
currently running on my keyserver.

Kim Minh.

BUGFIX: The last word of a user id was not properly case converted.

Properly downcase every word of the user id for word indexing purpose.

Reported in http://lists.gnu.org/archive/html/sks-devel/2009-08/msg00003.html

diff -r 46c6aaac31da utils.ml
--- a/utils.ml  Sat Mar 28 22:04:00 2009 -0400
+++ b/utils.ml  Thu Aug 06 17:49:37 2009 +0200
@@ -100,16 +100,17 @@
 
 
 let rec extract_words_rec s ~start ~len partial = 
+  let one () = Set.add (String.lowercase (String.sub s start len)) partial in
   if start + len = String.length s 
   then ( if len = 0 then partial 
-        else Set.add (String.sub s start len) partial )
+        else one ())
   else (
     if is_alnum s.[start + len]
     then extract_words_rec s ~start ~len:(len + 1) partial
     else ( if len = 0 
           then extract_words_rec s ~start:(start + 1) ~len partial
           else extract_words_rec s ~start:(start + len)  ~len:0
-            (Set.add (String.lowercase (String.sub s start len)) partial)
+            (one ())
         )
   )
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]