* lib/mkmf.rb (create_makefile): get rid of placing @ at the
beginning of replacement, which is the loop expansion mechanism
from the OSF Development Environment (ODE) make. fix failures
with bmake by r53448.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/mkmf.rb (configuration, dummy_makefile, create_makefile):
show library installation messages only when any files need to
be updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/rubygems/security.rb (DIGEST_ALGORITHM, KEY_ALGORITHM):
should check same name as the used constants.
[ruby-core:72674] [Bug #11940]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/ostruct.rb (freeze): define deferred accessors before
freezing to get rid of an error when just reading frozen
OpenStruct.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/forwardable.rb (def_instance_delegator): adjust backtrace of
method body by tail call optimization. adjusting the delegated
target is still done by deleting backtrace.
* lib/forwardable.rb (def_single_delegator): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/forwardable.rb (def_instance_delegator) fix delegating to
'args' and 'block', clashing with local variables in generated
methods. [ruby-core:72579] [Bug #11916]
* lib/forwardable.rb (def_single_delegator): ditto.
If you have a class that uses Forwardable to delegate a method to
another object, and the method that returns the delegate object is
called `args` or `block`, then Forwardable will fail to work.
Here's a simple example:
class ModelCreator
extend Forwardable
attr_reader :args
def_delegator :args, :model_name
def initialize(args)
@args = args
end
end
ModelCreator.new.model_name
If you run the last line above, then you'll get:
NoMethodError: undefined method `model_name' for []:Array
This error occurs because `def_delegator` -- as it is written in Ruby --
uses metaprogramming to add methods to the class that will then delegate
to the delegate object. So it's as if we had written:
class ModelCreator
extend Forwardable
attr_reader :args
def model_name(*args, &block)
args.model_name(*args, &block)
end
def initialize(args)
@args = args
end
end
As you can see, `def_delegator` will not only forward the method call
onto the delegate object, it will also forward any arguments provided as
well. It is here that the bug arises: it splats all of the arguments
into a variable which is called `args`, and because of how variable
scope works in Ruby, it then attempts to call `model_name` on *this*
variable and *not* our delegate object method.
The fix is to call the delegate object method manually using `__send__`.
(This assumes, of course, that the given receiver is, in fact, the name
of a method and not the name of an instance variable, which is also a
possibility.) We use `__send__` because the delegate object method could
be private.
So, that looks like this:
def model_name(*args, &block)
__send__(:args).model_name(*args, &block)
end
Because `def_delegators` and `delegate` use `def_delegator` internally,
they also get this fix as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/ostruct.rb (OpenStruct): make respond_to? working on
just-allocated objects for workaround of Psych.
[ruby-core:72501] [Bug #11884]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We should try with Ruby 2.4 or 3.0.
[Bug #11842][ruby-core:72374]
* lib/rdoc/erb_partial.rb: ditto.
* template/verconf.h.tmpl: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler#initialize):
use WEBrick::Utils::TimeoutHandler::Thread, which is ignored by
LeakChecker#find_threads, instead of ::Thread to get rid of
thread leak checker. since this TimeoutHandler is resident
during tests because of Singleton, it waits for the next timeout
if it has any schedules. in the case of nested timeouts, inner
timeout does not cancel outer timeouts and then those schedules
still remain.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/timeout.rb (Timeout#timeout): set watcher thread name to
caller location for debugging.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
potential deadlocks, Queue is used to tell update of @timeout_info
instead of sleep and wakeup. [Bug #11742] [ruby-dev:49387]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
TimeoutMutex only when accessing @timeout_info for avoiding
potential deadlock. [Bug #11742] [ruby-dev:49387]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
TimeoutMutex should be acquired when accessing @timeout_info.
To avoid deadlock, interrupt() calls are delayed.
Due to the mutex, it is safe to treat ary without ary.dup.
[Bug #11742] [ruby-dev:49387]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This fixes a bug introduced in r53066 when attempting to
shellescape an empty string.
* lib/shellwords.rb (shellescape): duplicate frozen literal
* test/test_shellwords.rb (test_stringification): new test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
this version includes #1396, #1397, #1398, #1399
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e