On 1/10/13 2:49 PM, Kevin A. McGrail wrote:
> On 1/10/2013 6:41 AM, Tom Hendrikx wrote:
>> Hi,
>>
>> I was trying to detect various error conditions during spamc execution
>> based on its exit code, which, according to its manpage, should be easy
>> using something -x / --no-safe-fallback.
>>
>> $ spamc --full -no-safe-fallback --port=12345 < message.eml; echo $?
>>
>> This nicely reports an exit code of 69 (where nothing is actually
>> listing on that port).
>>
>> However, checking for maxsize issues does not work:
>>
>> $ spamc --full --no-safe-fallback --max-size=10 < message.eml; echo $?
>>
>> This reports an exit code of 0. Checking the source code [1] tells me
>> that the exit code is suppressed on purpose, but the bugreport
>> referenced in the source code [2] doesn't explain why EX_TOOBIG should
>> be suppressed.
>>
>> So either the code has an issue, or the man page (as EX_TOOBIG can never
>> happen but it is documented). I'd rather see the code fixed, unless
>> there is a compelling reason not too which I failed to understand.
>>
>> Kind regards,
>>     Tom
>>
>> [1]
>> http://svn.apache.org/viewvc/spamassassin/trunk/spamc/spamc.c?view=markup
>> (line
>> 1050)
>> [2] https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5412
> My best guess, it exits that way so that the mail that is larger than
> the scan limit is still accepted by MTAs and continues along the process.
> 
> Suggest you look at bug 6717 perhaps and see if you can work up a patch
> to give the behavior you would like.

Since EX_TOOBIG is not really a temporary condition, I'm not sure if
that condition and the semantics of -X from the patch actually helps.

I'm thinking that it might be better to have a switch with the semantics
'Change all temporary errors to EX_TEMPFAIL' which would change most of
the named exit codes in the man page into EX_TEMPFAIL, except when the
message should be simply passed through (effectively only EX_TOOBIG).

This would do for integration as documented in the bug:
- spamc without special switch: exitcode indicates succes (0) or failure (1)
- spamc -<new>: exitcode indicates succes (0), failure (1) or retry (75)
- spamc -x: always raw exitcode

But I guess it depends largely on the setup and the sysadmins opinion
whether 'addressee unknown' is a temporary condition, so there is
another exception to be handled...

--
Tom

Reply via email to