Bug 3754

Summary: [review] sa-learn: successful return code though file not found
Product: Spamassassin Reporter: Duncan Findlay <duncf>
Component: LearnerAssignee: SpamAssassin Developer Mailing List <dev>
Severity: minor    
Priority: P5    
Version: SVN Trunk (Latest Devel Version)   
Target Milestone: 3.1.2   
Hardware: All   
OS: All   
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261346&repeatmerged=no
Whiteboard: ready
Attachments: suggested patch

Description Duncan Findlay 2004-09-06 09:26:19 UTC
Package: spamassassin
Version: 2.63-1
Severity: minor


the subject says it all...

sa-learn --spam --mbox /does/not/exist ; echo $?

will demonstrate it.

Comment 1 Bob Menschel 2005-04-07 21:07:33 UTC
Confirmed. Code within ArchiveIterator.pm does subroutine return with code
indicating success or failure on opening file, but failure code does not
translate to non-zero program exit code. This does not allow the calling cron
job to notify user of a problem (expected mail(s) to learn wasn't learned). 
Comment 2 Theo Van Dinter 2006-03-15 03:47:36 UTC
Created attachment 3413 [details]
suggested patch

wow, this bug's been around a while...

so here's a patch that implements a fix.  it's a little bit of a kluge, because
there's no direct way to pass an error opening a file back up to sa-learn at
the moment, and changing APIs to do it really isn't my first choice.
Comment 3 Daryl C. W. O'Shea 2006-03-31 01:50:49 UTC
Comment 4 Justin Mason 2006-04-03 11:43:30 UTC
Comment 5 Theo Van Dinter 2006-04-04 03:45:37 UTC
Committed revision 391215.