|Summary:||spamc: learning exit codes documentation wrong, possible uncaught error|
|Product:||Spamassassin||Reporter:||Karsten Bräckelmann <guenther>|
|Component:||spamc/spamd||Assignee:||SpamAssassin Developer Mailing List <dev>|
Description Karsten Bräckelmann 2009-02-18 14:22:43 UTC
The spamc docs state: -L learn type, --learntype=type Send message to spamd for learning. The "learn type" can be either spam, ham or forget. The exitcode for spamc will be set to 5 if the message was learned, or 6 if it was already learned. Doesn't work that way though. The exit code in both cases is 0 success, regardless whether the message has been learned, or not. No difference with the -x option. $ spamc -L ham < ham.msg; echo $? Message was already un/learned 0 The code in spamc.c clearly shows, that EX_OK will be returned always. (Just search for "Message was".) Also applies to trunk, the code didn't change.
Comment 1 Karsten Bräckelmann 2009-02-18 14:32:41 UTC
The fix should be quite trivial, adding 2 lines to set the ret value accordingly. Now I just wonder which one is actually wrong -- the code or the POD...
Comment 2 Karsten Bräckelmann 2009-02-18 15:46:18 UTC
Got the little bugger! :) rev 158134, looks like this was changed intentional, almost 4 years ago. Alas, the documentation hasn't been adjusted. Hmm, so successful learning, unavailable (aka previously learned) and even *service unavailable* all are expected to return 0, success? Seriously?
Comment 3 Karsten Bräckelmann 2009-02-18 15:48:46 UTC
(In reply to comment #2) > rev 158134 http://svn.apache.org/viewvc?view=rev&revision=158134 Hrm, I was hoping for a link. Sorry for the noise.
Comment 4 Karsten Bräckelmann 2009-02-18 18:00:55 UTC
(In reply to comment #2) > rev 158134, looks like this was changed intentional, almost 4 years ago. Alas, > the documentation hasn't been adjusted. > > Hmm, so successful learning, unavailable (aka previously learned) and even > *service unavailable* all are expected to return 0, success? Seriously? More digging. Turns out all of this is bug 1201, revision 158029 and some fixes after that. According to bug 1201 comment 47, 48 and 49 returning EX_OK indeed is the desired behavior. Thus, concerning "successful learned" and "already learned" this is a documentation bug. Still unsure about the removed EX_UNAVAILABLE from revision 158134. Correcting Summary. And hoping the rev hints get linkified this time.