You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2018/08/24 04:19:56 UTC

[Bug 7600] New: spamc safe fallback doesn't work for command-line usage error

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7600

            Bug ID: 7600
           Summary: spamc safe fallback doesn't work for command-line
                    usage error
           Product: Spamassassin
           Version: 3.4.1
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
          Assignee: dev@spamassassin.apache.org
          Reporter: martin@meltin.net
  Target Milestone: Undefined

spamc(1) says:

EXIT CODES
       By default, spamc will use the 'safe fallback' error recovery method.
       That means, it will always exit with an exit code of 0, even if an
       error was encountered.  If any error occurrs, it will simply pass
       through the unaltered message.

However, the following behaviour doesn't make me feel confident that this
is the case.

$ echo From foo@example.com | spamc --foobar ; echo $?
Error in argument 1 : option not found --foobar
SpamAssassin Client version 3.4.1
  compiled with SSL support (OpenSSL 1.1.0f  25 May 2017)

Usage: spamc [options] [-e command [args]] < message

Options:
  -d, --dest host[,host2]
                      Specify one or more hosts to connect to.
                      [default: localhost]
  -H , --randomize    Randomize IP addresses for the looked-up
                      hostname.
  -p, --port port     Specify port for connection to spamd.
                      [default: 783]
  -S, --ssl           Use SSL to talk to spamd.
  -U, --socket path   Connect to spamd via UNIX domain sockets.
  -F, --config path   Use this configuration file.
  -t, --timeout timeout
                      Timeout in seconds for communications to
                      spamd. [default: 600]
  -n, --connect-timeout timeout
                      Timeout in seconds when opening a connection to
                      spamd. [default: 600]
  --filter-retries retries
                      Retry filtering this many times if the spamd
                      process fails (usually times out) [default: 1]
  --filter-retry-sleep sleep
                      Sleep for this time between failed filter
                      attempts, in seconds [default: 1]
  --connect-retries retries
                      Try connecting to spamd tcp socket this many times
                      [default: 3]
  --retry-sleep sleep Sleep for this time between attempts to
                      connect to spamd, in seconds [default: 1]
  -s, --max-size size Specify maximum message size, in bytes.
                      [default: 500k]
  -u, --username username
                      User for spamd to process this message under.
                      [default: current user]
  -L, --learntype learntype
                      Learn message as spam, ham or forget to
                      forget or unlearn the message.
  -C, --reporttype reporttype
                      Report message to collaborative filtering
                      databases.  Report type should be 'report' for
                      spam or 'revoke' for ham.
  -B, --bsmtp         Assume input is a single BSMTP-formatted
                      message.
  -c, --check         Just print the summary line and set an exit
                      code.
  -y, --tests         Just print the names of the tests hit.
  -r, --full-spam     Print full report for messages identified as
                      spam.
  -R, --full          Print full report for all messages.
  --headers           Rewrite only the message headers.
  -E, --exitcode      Filter as normal, and set an exit code.
  -x, --no-safe-fallback
                      Don't fallback safely.
  -X, --unavailable-tempfail
                      When using -x, turn 'unavailable' error into
                      'tempfail'. This may be useful for an MTAs
                      to defer emails with a temporary SMTP error
                      instead of bouncing with a permanent SMTP
                      error.
  -l, --log-to-stderr Log errors and warnings to stderr.
  -e, --pipe-to command [args]
                      Pipe the output to the given command instead
                      of stdout. This must be the last option.
  -h, --help          Print this help message and exit.
  -V, --version       Print spamc version and exit.
  -K                  Keepalive check of spamd.
  -f                  (Now default, ignored.)
  -4                  Use IPv4 only for connecting to server.
  -6                  Use IPv6 only for connecting to server.

64


The above is obviously the return code that should be produced with -x:

           EX_USAGE        64  command line usage error

However, I haven't specified -x.

If spamc wants to support safe fallback with a command-line usage error then
the obvious thing to do is print the usage message to stderr and also pass
stdin to stdout.

If the above behaviour is expected then spamc(1) is wrong.  :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7600] spamc safe fallback doesn't work for command-line usage error

Posted by bu...@bugzilla.spamassassin.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7600

Kevin A. McGrail <km...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@apache.org
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Kevin A. McGrail <km...@apache.org> ---
You are misreading/misinterpreting things.  Safe fallback doesn't imply exit
code of 0 with invalid params.

It implies that if params are correct but something goes wrong with mail
processing, it will return exit 0 with the message returned intact and
unaltered so that mail still flows.

Sorry, considered invalid.  If you would like to clarify the docs, happy to add
a patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.