<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Sieve: numeric comparison with negative numbers fails</title> 
  <pubDate>Fri, 10 Apr 2026 09:50:15 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/7308</link> 
  <atom:link rel="self" type="application/rss+xml" title="Sieve: numeric comparison with negative numbers fails" href="https://bugs.horde.org/ticket/7308/rss" /> 
  <description>Sieve: numeric comparison with negative numbers fails</description> 
 
   
   
  <item> 
   <title>When using the Sieve backend in Ingo and setting numeric com</title> 
   <description>When using the Sieve backend in Ingo and setting numeric comparison of X-Spam-Score, Ingo generates a rule that compares the X-Spam-Score numerically with the entered value (e.g. 5). The problem is that this comparison fails with negative spam scores (which can be quite common) and the e-mail is moved into the spam folder. See, e.g.:

http://tomster.org/blog/archive/2004/12/15/spamfiltering-using-spamassassin-and-sieve



The rule will be correct if it checks for the minus sign.



Wrong:

if header :value &quot;ge&quot; :comparator &quot;i;ascii-numeric&quot; &quot;X-Spam-Score&quot; [&quot;6&quot;] {



Correct:

if allof ( not header :comparator &quot;i;ascii-casemap&quot; :contains &quot;X-Spam-Score&quot; &quot;-&quot;, header :value &quot;ge&quot; :comparator &quot;i;ascii-numeric&quot; &quot;X-Spam-Score&quot; [&quot;6&quot;] ) {



Working patch attached.</description> 
   <pubDate>Tue, 09 Sep 2008 09:11:58 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t48799</link> 
  </item> 
   
  <item> 
   <title>The patch looks fine, but only takes care about the spam fil</title> 
   <description>The patch looks fine, but only takes care about the spam filter. If you made this work for the Relational test instead, all numeric comparisons would take advantage of the fix.</description> 
   <pubDate>Thu, 11 Sep 2008 12:31:18 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t48840</link> 
  </item> 
   
  <item> 
   <title>That&#039;s right. The problem is, as Sieve simply doesn&#039;t compar</title> 
   <description>That&#039;s right. The problem is, as Sieve simply doesn&#039;t compare negative numbers correctly, there&#039;s no way to really fix it. If the header or comparison value are negative, the result is undefined.



See RFC (from January 2008): http://tools.ietf.org/html/rfc5231 

It&#039;s the standard that says that the comparison doesn&#039;t support negative numbers, so probably this won&#039;t be fixed soon. Maybe Horde should display a warning when using the Sieve backend.



It works for the spam case because the reasonable range of X-Spam-Score is positive and we can assume that mails with a negative score won&#039;t be spam regardless of the score. </description> 
   <pubDate>Thu, 11 Sep 2008 13:47:08 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t48849</link> 
  </item> 
   
  <item> 
   <title>We can still check for negative values in the headers and ig</title> 
   <description>We can still check for negative values in the headers and ignore the rules in this case, like you do it now with the spam rule patch.</description> 
   <pubDate>Thu, 11 Sep 2008 13:55:48 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t48850</link> 
  </item> 
   
  <item> 
   <title>OK, here is a new version of the patch, this time it&#039;s the R</title> 
   <description>OK, here is a new version of the patch, this time it&#039;s the Relational function that&#039;s changed. The change in the spam function was reverted because creating the Relational match has the same effect.



For comparisons &lt;=, &lt; and !=, the normal comparison is ORed with the check for the minus sign so negative numbers in the mail header match, too.



For comparisons &gt;=, &gt; and =, the minus sign in the mail header causes a non-match. 



It&#039;s still not possible to use negative numbers for the comparison (i.e. enter them in Horde and hope that they&#039;ll work). But at least all cases of negative numbers in the mail header are supported as long as the entered comparison value is positive.</description> 
   <pubDate>Fri, 12 Sep 2008 06:38:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t48874</link> 
  </item> 
   
  <item> 
   <title>This is a patch adding a warning to the Ingo help for the En</title> 
   <description>This is a patch adding a warning to the Ingo help for the English and German help.xml files</description> 
   <pubDate>Fri, 12 Sep 2008 07:20:12 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t48876</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/ingo/docs/CHANGES?rt=horde&amp;r1=1.55.2.122&amp;r2=1.55.2.123&amp;ty=u
http://cvs.horde.org/diff.php/ingo/lib/Script/sieve.php?rt=horde&amp;r1=1.63.10.37&amp;r2=1.63.10.38&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/ca_ES/help.xml?rt=horde&amp;r1=1.1.2.2&amp;r2=1.1.2.3&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/de_DE/help.xml?rt=horde&amp;r1=1.1.4.3&amp;r2=1.1.4.4&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/en_US/help.xml?rt=horde&amp;r1=1.9.4.3&amp;r2=1.9.4.4&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/es_ES/help.xml?rt=horde&amp;r1=1.1.2.5&amp;r2=1.1.2.6&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/eu_ES/help.xml?rt=horde&amp;r1=1.1.2.1&amp;r2=1.1.2.2&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/fi_FI/help.xml?rt=horde&amp;r1=1.1.2.7&amp;r2=1.1.2.8&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/fr_FR/help.xml?rt=horde&amp;r1=1.1.2.2&amp;r2=1.1.2.3&amp;ty=u
http://cvs.horde.org/diff.php/ingo/locale/lv_LV/help.xml?rt=horde&amp;r1=1.1.8.3&amp;r2=1.1.8.4&amp;ty=u</description> 
   <pubDate>Tue, 18 Aug 2009 22:35:07 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t55400</link> 
  </item> 
   
  <item> 
   <title>Tweaked and committed, thanks!</title> 
   <description>Tweaked and committed, thanks!</description> 
   <pubDate>Tue, 18 Aug 2009 22:35:45 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t55402</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git for this ticket:

MFB: Correct</title> 
   <description>Changes have been made in Git for this ticket:

MFB: Correctly match negative header values with numeric comparison in Sieve driver (bb@apc.ag, Bug #7308).

http://git.horde.org/diff.php/ingo/docs/CHANGES?rt=horde-git&amp;r1=a50332ef341fa29c7acda0ed3e449a207ef0584d&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/lib/Script/Sieve.php?rt=horde-git&amp;r1=9b22223f642b6ab65a71694ff34f709f06dfce9d&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/ca_ES/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/de_DE/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/en_US/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/es_ES/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/fi_FI/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/fr_FR/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a
http://git.horde.org/diff.php/ingo/locale/lv_LV/help.xml?rt=horde-git&amp;r1=34fde92a2cd38c530ede281396c13937d32f8554&amp;r2=bade9b19e5062957438ae2935ef95cb653250b1a</description> 
   <pubDate>Wed, 13 Jan 2010 00:10:39 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/7308#t57603</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
