Package: mutt
Version: 1.5.13-1.1
Severity: minor
Tags: upstream, patch, fixed-upstream

The sort-mailbox functionality when sort=spam is in effect sometimes
sorts very strangely.  The effect is that small negative spam scores
sort as if the negative sign were not present.  This primarily has
effect when sorting SpamAssassin scores.  I reported this problem
upstream.

  http://marc.theaimsgroup.com/?l=mutt-users&m=116348743908017&w=2

David Champion responded with this following message with a summary
that float conversion should be used instead of signed or unsigned
long conversion.

  http://marc.theaimsgroup.com/?l=mutt-users&m=116417895411118&w=2

A patch was included in the message.  For the archive I am going to
include the patch here.  The patch was applied to the mutt CVS tree
and will be released with the next version of mutt to be released.
  
  http://dev.mutt.org/cgi-bin/viewcvs.cgi/mutt/sort.c?r1=3.9&r2=3.10

Since this is only minor I would simply wait for the next upstream
mutt to release.  I am reporting it here simply because this was the
first place that I looked for this problem when I experienced it and
wanted to include it into the knowledge base for others.  At this time
it is only fixed in the CVS version and not yet in any release version
of mutt.

Bob


2006-11-22 23:08:01  David Champion  <[EMAIL PROTECTED]>  (brendan)

        * sort.c: Sort spam scores numerically even when they are in
        the form of floats or negative numbers.

Index: sort.c
===================================================================
RCS file: /home/roessler/cvs/mutt/sort.c,v
retrieving revision 3.9
diff -u -r3.9 sort.c
--- sort.c      17 Sep 2005 20:46:11 -0000      3.9
+++ sort.c      22 Nov 2006 06:57:06 -0000
@@ -160,6 +160,7 @@
   char   *aptr, *bptr;
   int     ahas, bhas;
   int     result = 0;
+  double  difference;
 
   /* Firstly, require spam attributes for both msgs */
   /* to compare. Determine which msgs have one.     */
@@ -183,8 +184,11 @@
   /* Both have spam attrs. */
 
   /* preliminary numeric examination */
-  result = (strtoul((*ppa)->env->spam->data, &aptr, 10) -
-            strtoul((*ppb)->env->spam->data, &bptr, 10));
+  difference = (strtod((*ppa)->env->spam->data, &aptr) -
+                strtod((*ppb)->env->spam->data, &bptr));
+
+  /* map double into comparison (-1, 0, or 1) */
+  result = (difference < 0.0 ? -1 : difference > 0.0 ? 1 : 0);
 
   /* If either aptr or bptr is equal to data, there is no numeric    */
   /* value for that spam attribute. In this case, compare lexically. */


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to