Mailing List Archive

spamc -L does not return 5, or 6
https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
-L learn 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.

Note that the spamd must run with the --allow-tell option for
this to work.


But when I run:
spamc -L ham --max-size=2000000 <filename

I get as output:
Message was already un/learned

But as exit code 0 I get while if the documentation is correct it should
be 6.
I tried adding -x and -E, but this did not change anything.
Is the documentation wrong, or is something going wrong?

I am on Debian 12 and the version is:
SpamAssassin Client version 4.0.0
compiled with SSL support (OpenSSL 3.0.8 7 Feb 2023)

I am running spamc as a non root user.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Re: spamc -L does not return 5, or 6 [ In reply to ]
On Tue, Nov 07, 2023 at 02:28:38AM +0100, Cecil Westerhof wrote:
>https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
> -L learn 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.
>
> Note that the spamd must run with the --allow-tell option for
> this to work.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

How are you running spamd? With -l / --allow-tell?



>But when I run:
> spamc -L ham --max-size=2000000 <filename
>
>I get as output:
> Message was already un/learned
>
>But as exit code 0 I get while if the documentation is correct it should
>be 6.
>I tried adding -x and -E, but this did not change anything.
>Is the documentation wrong, or is something going wrong?
>
>I am on Debian 12 and the version is:
> SpamAssassin Client version 4.0.0
> compiled with SSL support (OpenSSL 3.0.8 7 Feb 2023)
>
>I am running spamc as a non root user.

George
--
theall@tifaware.com
Re: spamc -L does not return 5, or 6 [ In reply to ]
"George A. Theall via users" <users@spamassassin.apache.org> writes:

> On Tue, Nov 07, 2023 at 02:28:38AM +0100, Cecil Westerhof wrote:
>>https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
>> -L learn 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.
>>
>> Note that the spamd must run with the --allow-tell option for
>> this to work.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> How are you running spamd? With -l / --allow-tell?

--pidfile=/run/spamd.pid --username=imaps --allow-tell --create-prefs --max-children 5 --helper-home-dir

And the learning does work. But I have to use the generated text
instead of the exit codes.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Re: spamc -L does not return 5, or 6 [ In reply to ]
>> On Tue, Nov 07, 2023 at 02:28:38AM +0100, Cecil Westerhof wrote:
>>>https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
>>> -L learn 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.
>>>
>>> Note that the spamd must run with the --allow-tell option for
>>> this to work.

>"George A. Theall via users" <users@spamassassin.apache.org> writes:
>> How are you running spamd? With -l / --allow-tell?

On 07.11.23 15:01, Cecil Westerhof wrote:
> --pidfile=/run/spamd.pid --username=imaps --allow-tell --create-prefs --max-children 5 --helper-home-dir
>
>And the learning does work. But I have to use the generated text
>instead of the exit codes.

I'm afraid that for --allow-tell and --username=imaps you need all
mailboxes to be writable under "imaps" user, e.g. virtual users or similar.

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Posli tento mail 100 svojim znamim - nech vidia aky si idiot
Send this email to 100 your friends - let them see what an idiot you are
Re: spamc -L does not return 5, or 6 [ In reply to ]
Matus UHLAR - fantomas <uhlar@fantomas.sk> writes:

>>> On Tue, Nov 07, 2023 at 02:28:38AM +0100, Cecil Westerhof wrote:
>>>>https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
>>>> -L learn 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.
>>>>
>>>> Note that the spamd must run with the --allow-tell option for
>>>> this to work.
>
>>"George A. Theall via users" <users@spamassassin.apache.org> writes:
>>> How are you running spamd? With -l / --allow-tell?
>
> On 07.11.23 15:01, Cecil Westerhof wrote:
>> --pidfile=/run/spamd.pid --username=imaps --allow-tell
>> --create-prefs --max-children 5 --helper-home-dir
>>
>>And the learning does work. But I have to use the generated text
>>instead of the exit codes.
>
> I'm afraid that for --allow-tell and --username=imaps you need all
> mailboxes to be writable under "imaps" user, e.g. virtual users or
> similar.

They are imaps -> imap over ssh.
But that is not the problem. Spamc does what it should be doing,
except that it gives back 0 instead of 5 or 6.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Re: spamc -L does not return 5, or 6 [ In reply to ]
On 11/7/23 18:38, Cecil Westerhof wrote:
> Matus UHLAR - fantomas <uhlar@fantomas.sk> writes:
>
>>>> On Tue, Nov 07, 2023 at 02:28:38AM +0100, Cecil Westerhof wrote:
>>>>> https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
>>>>> -L learn 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.
>>>>>
>>>>> Note that the spamd must run with the --allow-tell option for
>>>>> this to work.
>>
>>> "George A. Theall via users" <users@spamassassin.apache.org> writes:
>>>> How are you running spamd? With -l / --allow-tell?
>>
>> On 07.11.23 15:01, Cecil Westerhof wrote:
>>> --pidfile=/run/spamd.pid --username=imaps --allow-tell
>>> --create-prefs --max-children 5 --helper-home-dir
>>>
>>> And the learning does work. But I have to use the generated text
>>> instead of the exit codes.
>>
>> I'm afraid that for --allow-tell and --username=imaps you need all
>> mailboxes to be writable under "imaps" user, e.g. virtual users or
>> similar.
>
> They are imaps -> imap over ssh.
> But that is not the problem. Spamc does what it should be doing,
> except that it gives back 0 instead of 5 or 6.
>
It seems to be a documentation bug, see https://bz.apache.org/SpamAssassin/show_bug.cgi?id=6069 and https://bz.apache.org/SpamAssassin/show_bug.cgi?id=1201#c47

Giovanni
Re: spamc -L does not return 5, or 6 [ In reply to ]
On 2023-11-07 at 18:23:19 UTC-0500 (Wed, 8 Nov 2023 00:23:19 +0100)
<giovanni@paclan.it>
is rumored to have said:

> On 11/7/23 18:38, Cecil Westerhof wrote:
>> Matus UHLAR - fantomas <uhlar@fantomas.sk> writes:
[...]
>>
>> They are imaps -> imap over ssh.
>> But that is not the problem. Spamc does what it should be doing,
>> except that it gives back 0 instead of 5 or 6.
>>
> It seems to be a documentation bug, see https://bz.apache.org/SpamAssassin/show_bug.cgi?id=6069 and https://bz.apache.org/SpamAssassin/show_bug.cgi?id=1201#c47
>

Documentation fixed in r1913677

--
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire
Re: spamc -L does not return 5, or 6 [ In reply to ]
giovanni@paclan.it writes:

> On 11/7/23 18:38, Cecil Westerhof wrote:
>> Matus UHLAR - fantomas <uhlar@fantomas.sk> writes:
>>
>>>>> On Tue, Nov 07, 2023 at 02:28:38AM +0100, Cecil Westerhof wrote:
>>>>>> https://spamassassin.apache.org/full/3.1.x/doc/spamc.html says:
>>>>>> -L learn 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.
>>>>>>
>>>>>> Note that the spamd must run with the --allow-tell option for
>>>>>> this to work.
>>>
>>>> "George A. Theall via users" <users@spamassassin.apache.org> writes:
>>>>> How are you running spamd? With -l / --allow-tell?
>>>
>>> On 07.11.23 15:01, Cecil Westerhof wrote:
>>>> --pidfile=/run/spamd.pid --username=imaps --allow-tell
>>>> --create-prefs --max-children 5 --helper-home-dir
>>>>
>>>> And the learning does work. But I have to use the generated text
>>>> instead of the exit codes.
>>>
>>> I'm afraid that for --allow-tell and --username=imaps you need all
>>> mailboxes to be writable under "imaps" user, e.g. virtual users or
>>> similar.
>> They are imaps -> imap over ssh.
>> But that is not the problem. Spamc does what it should be doing,
>> except that it gives back 0 instead of 5 or 6.
>>
> It seems to be a documentation bug, see
> https://bz.apache.org/SpamAssassin/show_bug.cgi?id=6069 and
> https://bz.apache.org/SpamAssassin/show_bug.cgi?id=1201#c47

I understand, but do not agree. Long ago this was the case, but a lot
of programs give a non zero return code back without it being an
error. Even sa-update: here 1 means that there were no updates. I do
not see that as an error.
I hope I do not have to change my script in the near future because
sa-update is going to return zero when there are no updates.

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof