#37 Wrong output instead of error message on -o -o

closed-fixed
nobody
None
2
2003-03-04
2003-02-25
Tim Freeman
No

I'm running bogofilter 0.10.3.1-1 from Debian. Here's some
shell dialogue:

lobus:~/Procmail> bogofilter -2 -o 0.44 -v <
/tmp/spam.rmail
X-Bogosity: Yes, tests=bogofilter, spamicity=0.512495,
version=0.10.3.1
lobus:~/Procmail> bogofilter -2 -o -o 0.44 -v <
/tmp/spam.rmail
X-Bogosity: No, tests=bogofilter, spamicity=0.512495,
version=0.10.3.1
lobus:~/Procmail>

I don't know how bogofilter interpreted "-o -o" in the
second
command, so I don't know why the answer changed
from "Yes" to "No". I would have preferred to get an
error message instead of some unknown interpretation of
"-o -o".

Discussion

  • Tim Freeman

    Tim Freeman - 2003-02-25
    • priority: 5 --> 2
     
  • Matthias Andree

    Matthias Andree - 2003-02-26
    • status: open --> pending
     
  • Matthias Andree

    Matthias Andree - 2003-02-26

    Logged In: YES
    user_id=2788

    Bogofilter uses the atof(3) function to parse the argument
    to -o, and as it's non-numeric, it probably has interpreted
    the -o as 0.0.
    Future versions will however see the 0.44 (which remains
    unassigned) as additional argument that is not known how to
    be interpreted and complain. Is that sufficient?

     
  • Tim Freeman

    Tim Freeman - 2003-02-26

    Logged In: YES
    user_id=299187

    Complaining about an extra 0.44 would clearly be an improvement.

    Another possible improvement would be to use the strtod function
    that, unlike atof, reports errors. The only reason I can see
    not to use strtod is that perhaps atof is more commonly
    available.
    But the manual entry for strtod on my system says it's
    part of ANSI C, so maybe it will be very commonly available.

    Not a big deal in any case.

     
  • Tim Freeman

    Tim Freeman - 2003-02-26
    • status: pending --> open
     
  • Matthias Andree

    Matthias Andree - 2003-02-26

    Logged In: YES
    user_id=2788

    I have added simple wrappers around strtol (for atoi) and
    strtod (for atof) that further simplify checking for parse
    errors, but I haven't yet had the time to fix all occasions
    where we use atoi or atof, because I haven't yet had the
    time to figure the optimal way to report errors found.
    Configuration file parsing and the -o option have been
    switched to the new xatof() though in CVS.
    I'll worry about portability if someone reports a problem.
    autoconf has AC_FUNC_STRTOD (I can still resort to sscanf in
    that case), but the autoconf manual doesn't document what
    operating systems lack strtod().

    Fellow hackers, I'll leave this PR open until all
    atoi()/atof() are gone.

     
  • Matthias Andree

    Matthias Andree - 2003-02-26
    • status: open --> open-later
     
  • Matthias Andree

    Matthias Andree - 2003-03-04

    Logged In: YES
    user_id=2788

    Should be fixed in CVS.

     
  • Matthias Andree

    Matthias Andree - 2003-03-04
    • status: open-later --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks