I've got an application that goes through apache log files, and one of
the things is does is parse the dates. However, I'm getting mysterious
ocassional failures on what seem to be random lines, different every
time, and a line that wouldn't parse will start parsing when I put it
into a test case.
Here's the stacktrace, in this case I did a "Date.new(2003, 4, 11)":
Exception: Couldn't parse date 2003-4-11 (11/Apr/2003): NaN
/usr/local/lib/ruby/1.8/date.rb:300:in `floor'
/usr/local/lib/ruby/1.8/date.rb:300:in `civil_to_jd'
/usr/local/lib/ruby/1.8/date.rb:568:in `valid_civil?'
/usr/local/lib/ruby/1.8/date.rb:590:in `new'
./HttpLogRecord.rb:83:in `parse_apache_date'
./HttpLogRecord.rb:36:in `parse'
...
This happens both with 1.8.1 and 1.8.2preview2. Any thoughts?
Here's the stacktrace, in this case I did a "Date.new(2003, 4, 11)":
Exception: Couldn't parse date 2003-4-11 (11/Apr/2003): NaN
/usr/local/lib/ruby/1.8/date.rb:300:in `floor'
/usr/local/lib/ruby/1.8/date.rb:300:in `civil_to_jd'
/usr/local/lib/ruby/1.8/date.rb:568:in `valid_civil?'
/usr/local/lib/ruby/1.8/date.rb:590:in `new'
./HttpLogRecord.rb:83:in `parse_apache_date'
./HttpLogRecord.rb:36:in `parse'
...
This happens both with 1.8.1 and 1.8.2preview2. Any thoughts?
That is quite odd, I cannot recreate it on my machine. Although,
digging through the source code makes me think it might be a C library
issue with your "math.h" implementation. Granted I am nowhere close
to knowledgeable when it comes to this level of detail. So in order
to help the ones in the know; What is your output when you type
"ruby -v" ?
Best,
Zev
···
On Thu, 28 Oct 2004 17:23:59 +0900, Curt Sampson <cjs@cynic.net> wrote:
On Thu, 28 Oct 2004, Zev Blut wrote:
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.NetBSD.org
Make up enjoying your city life...produced by BIC CAMERA
Just for comparison's sake, here are the details of the machine I ran it on:
$ ruby -v
ruby 1.8.2 (2004-05-24) [i686-linux]
$ uname -a
Linux TwinStar 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 i686 i386
GNU/Linux
If I get some time this weekend I might boot up my Sparc 5 with NetBSD and see
what it does. But, hopefully someone in the know will answer the problem
before then
Best,
Zev
···
On Thu, 28 Oct 2004 19:49:21 +0900, Curt Sampson <cjs@cynic.net> wrote:
Tried to put it into irb, no problems found.
hramrach@Dell:ttyp2(1) 10290419 512:12]~ $ uname -a
NetBSD Dell 2.0_RC2 NetBSD 2.0_RC2 (Dell) #0: Sat Oct 2 23:46:21 CEST
2004 hramrach@Dell:/scratch/obj/usr/src/sys/arch/i386/compile/Dell i386
hramrach@Dell:ttyp2(1) 10290420 513:13]~ $ ruby -v
ruby 1.6.8 (2002-12-24) [i386-netbsdelf]
···
On Thu, Oct 28, 2004 at 08:09:09PM +0900, Zev Blut wrote:
On Thu, 28 Oct 2004 19:49:21 +0900, Curt Sampson <cjs@cynic.net> wrote:
>On Thu, 28 Oct 2004, Zev Blut wrote:
>
>>That is quite odd, I cannot recreate it on my machine.
>
>Did you try calling it a lot. It happens only once every few hundred
>thousand times.
Ah, no I did not. Although, I just tried it with the following code
with no problems.