I've found a bug in the 64 bit implementation of ruby -- I'm kind of new
to ruby, so I don't know if it's been fixed yet -- so
Here's the code:
---------------------cut here-------------------
data="\001\002\000\000\000\000\003\004"
num_one, num_two = data.unpack('NN')
printf("Found 0x%08x 0x%08x\n", num_one, num_two)
puts "Warning! 64 bit machine error detected!" if (num_one !=
0x01020000 || num_two != 0x00000304)
---------------------cut here-------------------
Here's the output on a 32 bit machine:
---------------------cut here-------------------
dfrascon@dfrascon-lnx-m32 ~ $ ruby --version
ruby 1.8.1 (2003-12-25) [i386-linux-gnu]
dfrascon@dfrascon-lnx-m32 ~ $ ruby test.rb
Found 0x01020000 0x00000304
---------------------cut here-------------------
And on a 64 bit machine
---------------------cut here-------------------
dfrascon@dfrascon-lnx bin $ ruby --version
ruby 1.8.1 (2003-12-25) [x86_64-linux-gnu]
dfrascon@dfrascon-lnx bin $ ruby ~/test.rb
Found 0x102000000000000 0x30400000000
Warning! 64 bit machine error detected!
--------------------cut here-------------------
There are no available patches for my linux distro, so I'll try grabing
the latest sources to fix.
-Dave
--
David Frascone
Can you repeat the part after "Listen very carefully"?