/usr/lib/ruby/vendor_ruby/net/ssh/ruby_compat.rb is in ruby-net-ssh 1:3.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | require 'thread'
class String
if RUBY_VERSION < "1.9"
def getbyte(index)
self[index]
end
def setbyte(index, c)
self[index] = c
end
end
end
module Net; module SSH
# This class contains miscellaneous patches and workarounds
# for different ruby implementations.
class Compat
# A workaround for an IO#select threading bug in certain versions of MRI 1.8.
# See: http://net-ssh.lighthouseapp.com/projects/36253/tickets/1-ioselect-threading-bug-in-ruby-18
# The root issue is documented here: http://redmine.ruby-lang.org/issues/show/1993
if RUBY_VERSION >= '1.9' || RUBY_PLATFORM == 'java'
def self.io_select(*params)
IO.select(*params)
end
else
SELECT_MUTEX = Mutex.new
def self.io_select(*params)
# It should be safe to wrap calls in a mutex when the timeout is 0
# (that is, the call is not supposed to block).
# We leave blocking calls unprotected to avoid causing deadlocks.
# This should still catch the main case for Capistrano users.
if params[3] == 0
SELECT_MUTEX.synchronize do
IO.select(*params)
end
else
IO.select(*params)
end
end
end
end
end; end
|