I’m not sure if this is a bug, and am looking for more input from more
people.
We are trying to upgrade an app from 1.9.1-p243 to 1.9.3.
We have an OSX-specific fix in place to prevent a BPF interface kernel
caching problem (basically the interface blocks forever) so we pass in
the BIOCIMMEDIATE command to ioctl to prevent it.
if RUBY_PLATFORM =~ /darwin/
@io.ioctl(BIOCIMMEDIATE, “\x01”)
end
Where BIOCIMMEDIATE = 0x80044270
More info here for those interested:
http://opensource.apple.com/source/libpcap/libpcap-9/libpcap/pcap-bpf.c
(large comment near the bottom).
Running 32-bit ruby in 1.9.1 and 1.9.2 ( I am using RVM and haven’t
tested it in a non-rvm instance), the command works just fine:
ruby-1.9.1-p243 :001 > a,b = IO.pipe
=> [#IO:0x202fefc, #IO:0x202fec4]
ruby-1.9.1-p243 :002 > a.ioctl(0x80044270, “\x01”)
Errno::ENOTTY: Inappropriate ioctl for device
from (irb):2:in ioctl' from (irb):2 from /Users/dlampa/.rvm/rubies/ruby-1.9.1-p243/bin/irb:16:in
’
The command would (and does) work with a proper receiver device.
However, in 1.9.3-p125 (also 32-bit) it throws a range error:
ruby-1.9.3-p125 :001 > a,b = IO.pipe
=> [#<IO:fd 5>, #<IO:fd 6>]
ruby-1.9.3-p125 :002 > a.ioctl(0x80044270, “\x01”)
RangeError: bignum too big to convert into long' from (irb):2:in
ioctl’
from (irb):2
from /Users/dlampa/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `’
I assume that it’s caused by bit-signing even though looking at
0x80044270 it is a 32-bit unsigned number.
Can anyone provide some more detail? Am I witnessing a bug here? Am I
completely off?
I found this issue: http://bugs.ruby-lang.org/issues/5429 which seems to
be related, but I don’t speak Japanese unfortunately.
Any info would be awesome.