Daniel Berger
4/5/2007 7:04:00 PM
On Apr 5, 12:28 pm, Martin Gagnon <skidoo1...@gmail.com> wrote:
> Just noticing that the numbers returned by IO#pos are way off, but
> cycling through 4 values.
> This test script:
> -----
> f = File.open("test.txt", "r+")
> puts "f.pos: #{f.pos}"
> -----
> produces successively:
> f.pos: 1160802808249712640
> f.pos: 3466645817463406592
> f.pos: 5772488826677100544
> f.pos: 8078331835890794496
> f.pos: 1160802808249712640
> f.pos: 3466645817463406592
> f.pos: 5772488826677100544
> f.pos: 8078331835890794496
> The difference is constant: 2305843009213693952 (2^61)
>
> And this script:
> -----
> 3.times do
> f = File.new("/home/martin/test.txt")
> puts "f.pos: #{f.pos}"
> end
> -----
> produces successively:
> f.pos: 1160802808249712640
> f.pos: 1160802808249712640
> f.pos: 1160802808249712640
> -----
> f.pos: 3466645817463406592
> f.pos: 3466645817463406592
> f.pos: 3466645817463406592
Well, it looks like IO#pos is broken on QNX. That, or QNX 6.3 has a
nasty bug that's preventing it from working.
At this point I think you're relegated to testing standalone C
programs, and comparing those against the implementation in io.c and
rubyio.h, using a debugger to see what's getting fouled up.
One idea would be to create a standalone C program that includes the
appropriate Ruby header files (I think you'll need intern.h, ruby.h
and rubyio.h), and uses rb_io_tell() to try to simulate what the Ruby
code is doing. Then, debug from there.
Sorry I can't be more helpful.
Regards,
Dan