Bug Tracker item #2917031, was opened at 2009-12-18 14:51
Message generated for change (Comment added) made by sbajic
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2917031&group_id=250683

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: daemon
Group: v3.9.0
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: steve381 (steve381)
Assigned to: Stevan Bajic (sbajic)
Summary: MTA Option "broken returnCodes" not working

Initial Comment:
in dspam 3.9.0-RC2 "broken returnCodes" are not working for processing or 
relearning messages .
if i only classify messages it's working fine
in dspam 3.8.0 it's working .

TEST1 : only classify message
Version 3.8.0
----------------
# /opt/dspam/bin/dspam --user #### --classify  --stdout < /home/dspamtest/mail1
X-DSPAM-Result: ####; result="Spam"; class="Spam"; probability=0.7177; 
confidence=0.49; signature=N/A
# echo $?
99

Version 3.9.0-RC2
----------------------
# /opt/dspam-3.9.0-RC2/bin/dspam --user #### --classify  --stdout < 
/home/dspamtest/mail1
X-DSPAM-Result: hi...@wvnet.at; result="Spam"; class="Spam"; 
probability=0.7177; confidence=0.51; signature=N/A
# echo $?
99

TEST2 : process message
Version 3.8.0
----------------
# /opt/dspam/bin/dspam --user #### --process --deliver=innocent,spam --stdout < 
/home/dspamtest/mail1 >/dev/null
# echo $?
99

Version 3.9.0-RC2
----------------------
# /opt/dspam-3.9.0-RC2/bin/dspam --user #### --process --deliver=innocent,spam 
--stdout < /home/dspamtest/mail1 >/dev/null
#echo $?
0

Same Situation in retraining mails ( --class=spam --source=error )

I have attached the mail which i have used for testing and the output from 
"stdout"




----------------------------------------------------------------------

>Comment By: Stevan Bajic (sbajic)
Date: 2009-12-21 13:54

Message:
> As you can see there is some negativ error in the command output (-2)
but
> the returncode is still 0 ( seems to be allready broken in 3.8.0 )
>
Normally a shell can not capture negative return values (I think just 0 to
255 is possible in shell). Use another tool that can capture negative exit
codes.

But the other stuff that you have mentioned in your first bug report are
fixed by the patch?


----------------------------------------------------------------------

Comment By: steve381 (steve381)
Date: 2009-12-21 13:36

Message:
I'm not sure if this is really a bug , but dspam.conf says ( for broken
return ) that
if we have an error the return code should be negativ .

if made a simple classify with an unknown user  the retrun code is still 0

# /opt/dspam-3.9.0-RC2/bin/dspam --user unknown --classify --stdout <
/home/dspamtest/mail1
#echo $?
0

in the debug log i have following
19911: [12/21/2009 13:22:45] parsing message body
19911: [12/21/2009 13:22:45] _mysql_drv_getpwnam: returning NULL for query
on name: unknown
19911: [12/21/2009 13:22:45] _ds_getall_spamrecords: unable to
_mysql_drv_getpwnam(unknown)
19911: [12/21/2009 13:22:45] _ds_getall_spamrecords() failed

if i made the same test with version 3.8.0 i get the following

# /opt/dspam/bin/dspam --user unknown --classify --stdout <
/home/dspamtest/mail1
23924: [12/21/2009 13:30:33] bailing on error -2
23924: [12/21/2009 13:30:33] received invalid result (! DSR_ISSPAM ||
DSR_INNOCENT) : -2
#echo $?
0

As you can see there is some negativ error in the command output (-2) but
the returncode is still 0 ( seems to be allready broken in 3.8.0 )



----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2009-12-19 22:29

Message:
Patch submitted to GIT. Should it not work then just post again here in
this bug report what is not working and we will try to fix it ASAP.

----------------------------------------------------------------------

Comment By: steve381 (steve381)
Date: 2009-12-19 21:46

Message:
Looks good , thanks for the quick response !

#/opt/dspam-3.9.0-RC2/bin/dspam --user #### --process
--deliver=innocent,spam --stdout < /home/dspamtest/mail1 >/dev/null
#echo $?
99

will do some more tests on monday ...

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2009-12-18 19:50

Message:
Can you try if the following patch is fixing that issue?
-------------------
diff --git a/src/dspam.c b/src/dspam.c
index 98a337e..e7922f3 100644
--- a/src/dspam.c
+++ b/src/dspam.c
@@ -1,4 +1,4 @@
-/* $Id: dspam.c,v 1.382 2009/12/06 18:06:42 sbajic Exp $ */
+/* $Id: dspam.c,v 1.383 2009/12/18 19:43:52 sbajic Exp $ */

 /*
  DSPAM
@@ -1584,7 +1584,7 @@ int send_notice(
  */

 int process_users(AGENT_CTX *ATX, buffer *message) {
-  int i = 0, have_rcpts = 0, retcode = 0;
+  int i = 0, have_rcpts = 0, return_code = 0, retcode = 0;
   struct nt_node *node_nt;
   struct nt_node *node_rcpt = NULL;
   struct nt_c c_nt, c_rcpt;
@@ -1897,7 +1897,7 @@ int process_users(AGENT_CTX *ATX, buffer *message)
{

       if (_ds_match_attribute(agent_config, "Broken", "returnCodes")) {
         if (result == DSR_ISSPAM)
-          retcode = 99;
+          return_code = 99;
       }

       /*
@@ -2104,11 +2104,11 @@ RSET:
     } else
       free(presult);
     presult = NULL;
-    LOGDEBUG ("DSPAM Instance Shutdown.  Exit Code: %d", retcode);
+    LOGDEBUG ("DSPAM Instance Shutdown.  Exit Code: %d", return_code);
     buffer_destroy(parse_message);
   }

-  return retcode;
+  return return_code;
 }
 // break
 // load_agg
-------------------

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2917031&group_id=250683

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to