Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ The following bundled gems are promoted from default gems.
* rdoc 6.14.2
* win32ole 1.9.2
* irb 1.15.2
* reline 0.6.1
* reline 0.6.2
* readline 0.0.4
* fiddle 1.1.8

Expand Down
41 changes: 24 additions & 17 deletions encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ must_encindex(int index)
rb_raise(rb_eEncodingError, "encoding index out of bound: %d",
index);
}
if (ENC_TO_ENCINDEX(enc) != (int)(index & ENC_INDEX_MASK)) {
rb_raise(rb_eEncodingError, "wrong encoding index %d for %s (expected %d)",
index, rb_enc_name(enc), ENC_TO_ENCINDEX(enc));
}
if (rb_enc_autoload_p(enc) && rb_enc_autoload(enc) == -1) {
rb_loaderror("failed to load encoding (%s)",
rb_enc_name(enc));
}
if (ENC_TO_ENCINDEX(enc) != (int)(index & ENC_INDEX_MASK)) {
rb_raise(rb_eEncodingError, "wrong encoding index %d for %s (expected %d)",
index, rb_enc_name(enc), ENC_TO_ENCINDEX(enc));
}
return enc;
}

Expand Down Expand Up @@ -792,26 +792,33 @@ enc_autoload_body(rb_encoding *enc)
}
} while (enc_table->list[i].enc != base && (++i, 1));
}
}

if (i == -1) return -1;
if (i != -1) {
if (base) {
bool do_register = true;
if (rb_enc_autoload_p(base)) {
if (rb_enc_autoload(base) < 0) {
do_register = false;
i = -1;
}
}

if (base) {
if (rb_enc_autoload_p(base)) {
if (rb_enc_autoload(base) < 0) return -1;
}
i = enc->ruby_encoding_index;
i = enc->ruby_encoding_index;
if (do_register) {
enc_register_at(enc_table, i & ENC_INDEX_MASK, rb_enc_name(enc), base);
((rb_raw_encoding *)enc)->ruby_encoding_index = i;
}

GLOBAL_ENC_TABLE_LOCKING(enc_table) {
enc_register_at(enc_table, i & ENC_INDEX_MASK, rb_enc_name(enc), base);
i &= ENC_INDEX_MASK;
}
else {
i = -2;
}
}

((rb_raw_encoding *)enc)->ruby_encoding_index = i;
i &= ENC_INDEX_MASK;
return i;
}

return -2;
return i;
}

int
Expand Down
2 changes: 1 addition & 1 deletion gems/bundled_gems
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ logger 1.7.0 https://github.com/ruby/logger
rdoc 6.14.2 https://github.com/ruby/rdoc
win32ole 1.9.2 https://github.com/ruby/win32ole
irb 1.15.2 https://github.com/ruby/irb 331c4e851296b115db766c291e8cf54a2492fb36
reline 0.6.1 https://github.com/ruby/reline
reline 0.6.2 https://github.com/ruby/reline
readline 0.0.4 https://github.com/ruby/readline
fiddle 1.1.8 https://github.com/ruby/fiddle
6 changes: 6 additions & 0 deletions spec/bundler/support/hax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ def getaddrinfo(host, port)
Socket.singleton_class.prepend FakeResolv
end
end

# mise installed rubygems_plugin.rb to system wide `site_ruby` directory.
# This empty module avoid to call `mise` command.
module ReshimInstaller
def self.reshim; end
end
6 changes: 6 additions & 0 deletions test/rubygems/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1578,3 +1578,9 @@ def stub(name, val_or_callable, *block_args)
end

require_relative "utilities"

# mise installed rubygems_plugin.rb to system wide `site_ruby` directory.
# This empty module avoid to call `mise` command.
module ReshimInstaller
def self.reshim; end
end