(fwd) bogofilter 0.10.3.1 fails if started w/ 'bogofilter -l'

Matthias Andree matthias.andree at gmx.de
Fri Feb 21 13:02:41 CET 2003


Hi,

the attached problem report has been filed against the FreeBSD package
of 0.10.3.1. The patch however isn't correct.

I can confirm the problem exists on FreeBSD 4.8-PRERELEASE:

ma at libertas:~ > bogofilter -l
bogofilter: Internal error: unhandled option ':' (3A)

...which is wrong, because ':' means "missing mandatory argument" (we
prefix optstring with a colon).

I also see -l is not listed in the bogofilter -h output.

Note that FreeBSD's getopt(3) man page discourages using getopt() with
option letters (such as -3):

     It is also possible to handle digits as option letters.  This
     allows getopt() to be used with programs that expect a number
     (``-3'') as an option.  This practice is wrong, and should not be
     used in any current development.  It is provided for backward
     compatibility only. (...)

Note also that the Open Groups Base Specification discourages "optional"
option-arguments:

     *Guideline 7:*
        Option-arguments should not be optional.

I have found no robust and portable way to treat optional arguments, the
best I could get to was a very inconsistent way of treating spaces after
option arguments, but I don't want to depend on GNU getopt either or
switch behaviour depending on whether GNU getopt happens to be installed.

I've split the arguments into -l to enable syslog and -L to enable
syslog and configure the %l tag -- this works consistently and is
portable. Fix in CVS. Note that bogofilter now aborts when extra
arguments are specified; this will abort on -l xx (and warrant a mention
in NEWS, which I'll commit in some minutes) which will have to be
replaced by -L.

-- 
Matthias Andree
-------------- next part --------------
An embedded message was scrubbed...
From: Alex Vasylenko <lxv at send-pr.sink.omut.org>
Subject: bogofilter 0.10.3.1 fails if started w/ 'bogofilter -l'
Date: Thu, 20 Feb 2003 19:14:46 -0800 (PST)
Size: 2969
URL: <https://www.bogofilter.org/pipermail/bogofilter-dev/attachments/20030221/7dc706dd/attachment.mht>


More information about the bogofilter-dev mailing list