pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/34859: ruby with native pthread broken



I rebuilt all ruby and its installed libraries from scratch but it
happened again.

> > Kambe-san, do you have any idea whether "comparison of Fixnum with Float 
failed"
> > can happen on `min' method for an array?

I inserted some debug prints and found that [NaN, 0].min can produce
the exception.

% irb
irb(main):001:0> a = 0.0 / 0.0
=> NaN
irb(main):002:0> [a, 1].min
ArgumentError: comparison of Fixnum with Float failed    <==== (*)
       from (irb):2:in `min'
       from (irb):2:in `each'
       from (irb):2:in `min'
       from (irb):2

~% bsfilter -u --verbose
start Thu, Oct 26 2006 16:49:13 +0900
open /home/kochi/.bsfilter/C.clean.sdbm 32518 tokens 1278 mails by 5136.
open /home/kochi/.bsfilter/C.spam.sdbm 79001 tokens 8010 mails by 5136.
/home/kochi/bin/bsfilter:261:in `min': comparison of Fixnum with Float
failed (ArgumentError)
        from /home/kochi/bin/bsfilter:1726:in `each'
        from /home/kochi/bin/bsfilter:1726:in `min'
        from /home/kochi/bin/bsfilter:1726:in `update_probability'
        from /home/kochi/bin/bsfilter:1724:in `each'
        from /home/kochi/bin/bsfilter:1724:in `update_probability'
        from /home/kochi/bin/bsfilter:3348:in `run'
        from /home/kochi/bin/bsfilter:3345:in `each'
        from /home/kochi/bin/bsfilter:3345:in `run'
        from /home/kochi/bin/bsfilter:3412

Mmm, this may not be informative ;(

The line that produced the trace above is:

        b = [@spam.value(category, token) || 0, s_count].min

and I tried to change the above into:

       begin
         b = [@spam.value(category, token) || 0, s_count].min
       rescue ArgumentError
         p @spam.value(category, token)
         p @spam.value(category, token) || 0
         p s_count
       end

and see how they print.

The result varied:

case 1: NaN, NaN, 8028
case 2: NaN, undefined method `value' for nil:NilClass (NoMethodError)
case 3: NaN, 2.0, 8028

Apparently @spam.value(...) is producing NaN but (NaN) || 0 seems
producing random results.

I'll investigate this further while I'll try other DBMs (gdbm, qdbm, ...)
as well.

--
Takayoshi Kochi



Home | Main Index | Thread Index | Old Index