It's the only part that needs "root folder resultion" to figure out the
folder for the cache, but it's only needed for some things, so run that
logic lazily when needed.
https://github.com/rubygems/rubygems/commit/c7b9eae0bc
Normally, we use `require_relative` when requiring internal code.
However, Bundler may also load external code (for example, bundler
plugins), and when that external code loads Bundler itself, using
`require_relative` without setting up the `$LOAD_PATH` may lead into
double load errors.
For example, when testing a Gemfile using plugins using our source code
tree, I get the following:
```
➜ plugins-dup ~/Code/rubygems/rubygems/bundler/exe/bundle
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using bundler 2.5.0.dev
Installing extended_bundler-errors 0.3.3
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/version.rb:4: warning: already initialized constant Bundler::VERSION
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/version.rb:4: warning: previous definition of VERSION was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/worker.rb:5: warning: already initialized constant Bundler::Worker::POISON
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/worker.rb:5: warning: previous definition of POISON was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/fileutils/lib/fileutils.rb:183: warning: already initialized constant Bundler::FileUtils::VERSION
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb:183: warning: previous definition of VERSION was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/fileutils/lib/fileutils.rb:2165: warning: already initialized constant Bundler::FileUtils::Entry_::S_IF_DOOR
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb:2165: warning: previous definition of S_IF_DOOR was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/fileutils/lib/fileutils.rb:2461: warning: already initialized constant Bundler::FileUtils::Entry_::DIRECTORY_TERM
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb:2461: warning: previous definition of DIRECTORY_TERM was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/fileutils/lib/fileutils.rb:2569: warning: already initialized constant Bundler::FileUtils::OPT_TABLE
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb:2569: warning: previous definition of OPT_TABLE was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/fileutils/lib/fileutils.rb:2627: warning: already initialized constant Bundler::FileUtils::LOW_METHODS
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb:2627: warning: previous definition of LOW_METHODS was here
/Users/deivid/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/fileutils/lib/fileutils.rb:2634: warning: already initialized constant Bundler::FileUtils::METHODS
/Users/deivid/Code/rubygems/rubygems/bundler/lib/bundler/vendor/fileutils/lib/fileutils.rb:2634: warning: previous definition of METHODS was here
Failed to install plugin `extended_bundler-errors`, due to Bundler::Plugin::MalformattedPlugin (ArgumentError: Trying to register Bundler::GemfileError for status code 4 but
Bundler::GemfileError is already registered)
```
Changing this to always use `$LOAD_PATH` fixes the problem.
https://github.com/rubygems/rubygems/commit/121a861c39
If we're in inline mode, Bundler first resolves using only local gems,
and if some gems are missing, then it re-resolves using remote gems.
However, "source resolution" from the initial "local" try was being
memoized, resulting in Bundler not looking for some gems remotely in the
second resolution.
This commit forces a proper re-resolve in this case.
https://github.com/rubygems/rubygems/commit/fdc631075e
(https://github.com/ruby/irb/pull/598)
* Rename conf to irb_context
* Drop Nop#irb method because it's only used by irb/ext/loader.rb
We don't need to expose this method to all command classes, especially
when it's just an alias of `irb_context.irb`.
(https://github.com/ruby/irb/pull/599)
I received a `RegexpError` when I typed `::Array[`.
::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
This reverts commit 10621f7cb9.
This was reverted because the gc integrity build started failing. We
have figured out a fix so I'm reopening the PR.
Original commit message:
Fix cvar caching when class is cloned
The class variable cache that was added in
ruby#4544 changed the behavior of class
variables on cloned classes. As reported when a class is cloned AND a
class variable was set, and the class variable was read from the
original class, reading a class variable from the cloned class would
return the value from the original class.
This was happening because the IC (inline cache) is stored on the ISEQ
which is shared between the original and cloned class, therefore they
share the cache too.
To fix this we are now storing the `cref` in the cache so that we can
check if it's equal to the current `cref`. If it's different we don't
want to read from the cache. If it's the same we do. Cloned classes
don't share the same cref with their original class.
This will need to be backported to 3.1 in addition to 3.2 since the bug
exists in both versions.
We also added a marking function which was missing.
Fixes [Bug #19379]
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Fix:
```
1) Failure:
TestGc#test_latest_gc_info_need_major_by [/home/runner/work/ruby/ruby/src/test/ruby/test_gc.rb:266]:
<nil> expected to not be nil.
```
`GC.stat(:major_gc_count)` can be bumped while `GC.latest_gc_info(:need_major_by)` is still nil.
(https://github.com/ruby/irb/pull/594)
* Use require_relative for envutil.rb
Requiring test helper files with `require_relative` allows running the tests
with `ruby -Itest test/irb/test_debug_cmd.rb` without having to set up
the load path.
* Replace reline hack with TERM=dumb
The class variable cache that was added in
https://github.com/ruby/ruby/pull/4544 changed the behavior of class
variables on cloned classes. As reported when a class is cloned AND a
class variable was set, and the class variable was read from the
original class, reading a class variable from the cloned class would
return the value from the original class.
This was happening because the IC (inline cache) is stored on the ISEQ
which is shared between the original and cloned class, therefore they
share the cache too.
To fix this we are now storing the `cref` in the cache so that we can
check if it's equal to the current `cref`. If it's different we don't
want to read from the cache. If it's the same we do. Cloned classes
don't share the same cref with their original class.
This will need to be backported to 3.1 in addition to 3.2 since the bug
exists in both versions.
We also added a marking function which was missing.
Fixes [Bug #19379]
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>