diff --git a/.gitignore b/.gitignore index 7ead3a81f506b0..6ec036860829d4 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,7 @@ lcov*.info /*-fake.rb /*.dll /*.exe +/*.ilk /*.res /*.pc /*.rc diff --git a/NEWS.md b/NEWS.md index 004e151df07bd9..3ba44ddeb87e75 100644 --- a/NEWS.md +++ b/NEWS.md @@ -131,7 +131,7 @@ releases. * pstore 0.2.1 * 0.2.0 to [v0.2.1][pstore-v0.2.1] * rdoc 8.0.0 - * 7.0.3 to [v7.0.4][rdoc-v7.0.4], [v7.1.0][rdoc-v7.1.0], [v7.2.0][rdoc-v7.2.0] + * 7.0.3 to [v7.0.4][rdoc-v7.0.4], [v7.1.0][rdoc-v7.1.0], [v7.2.0][rdoc-v7.2.0], [v8.0.0][rdoc-v8.0.0] * win32ole 1.9.3 * 1.9.2 to [v1.9.3][win32ole-v1.9.3] * irb 1.18.0 @@ -286,6 +286,7 @@ A lot of work has gone into making Ractors more stable, performant, and usable. [rdoc-v7.0.4]: https://github.com/ruby/rdoc/releases/tag/v7.0.4 [rdoc-v7.1.0]: https://github.com/ruby/rdoc/releases/tag/v7.1.0 [rdoc-v7.2.0]: https://github.com/ruby/rdoc/releases/tag/v7.2.0 +[rdoc-v8.0.0]: https://github.com/ruby/rdoc/releases/tag/v8.0.0 [win32ole-v1.9.3]: https://github.com/ruby/win32ole/releases/tag/v1.9.3 [irb-v1.17.0]: https://github.com/ruby/irb/releases/tag/v1.17.0 [irb-v1.18.0]: https://github.com/ruby/irb/releases/tag/v1.18.0 diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c index a6154c83ec52de..a60f6a3c95511b 100644 --- a/ext/json/parser/parser.c +++ b/ext/json/parser/parser.c @@ -2625,11 +2625,16 @@ static VALUE cResumableParser_partial_value_body(VALUE self) missing_object_value = 1; } - // Copy the value stack as we need to mutate it. + // Copy the value stack as we need to mutate it. The collapse loop folds each + // open container by popping its entries and pushing the single result, so a + // parent always reclaims its child's slot; head exceeds its live size by at + // most one, either for the missing-value placeholder pushed below or for the + // result of folding an empty innermost container. That one spare slot keeps + // rvalue_stack_push from growing (reallocating) this ALLOCV buffer. long capa = parser.value_stack.head; - parser.value_stack.capa = (capa + missing_object_value); - VALUE tmpbuf, *value_stack_buffer = ALLOCV_N(VALUE, tmpbuf, capa + missing_object_value); - MEMCPY(value_stack_buffer, parser.value_stack.ptr, VALUE, parser.value_stack.capa); + parser.value_stack.capa = capa + 1; + VALUE tmpbuf, *value_stack_buffer = ALLOCV_N(VALUE, tmpbuf, parser.value_stack.capa); + MEMCPY(value_stack_buffer, parser.value_stack.ptr, VALUE, capa); parser.value_stack.ptr = value_stack_buffer; JSON_ParserState *state = &parser.state; diff --git a/gc/mmtk/mmtk.c b/gc/mmtk/mmtk.c index 39b6fb4c87f094..d996b923525430 100644 --- a/gc/mmtk/mmtk.c +++ b/gc/mmtk/mmtk.c @@ -965,8 +965,7 @@ size_t rb_gc_impl_heap_id_for_size(void *objspace_ptr, size_t size) { for (int i = 0; i < MMTK_HEAP_COUNT; i++) { - if (size == heap_sizes[i]) return i; - if (size < heap_sizes[i]) return i; + if (size <= heap_sizes[i]) return i; } rb_bug("size too big"); diff --git a/spec/bundler/bundler/mirror_spec.rb b/spec/bundler/bundler/mirror_spec.rb index ba1c6ed413daf8..34e61644fdf031 100644 --- a/spec/bundler/bundler/mirror_spec.rb +++ b/spec/bundler/bundler/mirror_spec.rb @@ -298,15 +298,13 @@ context "with a listening TCP Server" do def with_server_and_mirror - server = TCPServer.new("0.0.0.0", 0) - mirror = Bundler::Settings::Mirror.new("http://0.0.0.0:#{server.addr[1]}", 1) + server = TCPServer.new("127.0.0.1", 0) + mirror = Bundler::Settings::Mirror.new("http://127.0.0.1:#{server.addr[1]}", 1) yield server, mirror server.close unless server.closed? end it "probes the server correctly" do - skip "obscure error" if Gem.win_platform? - with_server_and_mirror do |server, mirror| expect(server.closed?).to be_falsey expect(probe.replies?(mirror)).to be_truthy diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb index 1172d661ae69e2..57c4743e85f9e9 100644 --- a/spec/bundler/install/git_spec.rb +++ b/spec/bundler/install/git_spec.rb @@ -40,8 +40,6 @@ end it "displays the ref of the gem repository when using branch~num as a ref" do - skip "maybe branch~num notation doesn't work on Windows' git" if Gem.win_platform? - build_git "foo", "1.0", path: lib_path("foo") rev = revision_for(lib_path("foo"))[0..6] update_git "foo", "2.0", path: lib_path("foo"), gemspec: true diff --git a/test/json/resumable_parser_test.rb b/test/json/resumable_parser_test.rb index 4cc6c085dff7c3..734d6e220b769d 100644 --- a/test/json/resumable_parser_test.rb +++ b/test/json/resumable_parser_test.rb @@ -247,6 +247,17 @@ def test_partial_value assert_partial_value([1, { "a" => 1, "b" => { "c" => nil } }], '[1, { "a": 1, "b": { "c"') end + def test_partial_value_collapses_nested_incomplete_containers + # partial_value rebuilds the open containers on a scratch value stack; folding + # an empty inner container pushes a value, so that stack must hold more than its + # live size or the push reallocates the scratch buffer. + assert_partial_value({ "abc" => {} }, '{"abc":{"d') + assert_partial_value({ "a" => { "b" => { "c" => {} } } }, '{"a":{"b":{"c":{"e') + assert_partial_value([1, { "a" => {} }], '[1,{"a":{"d') + assert_partial_value({ "a" => [1, { "b" => [2, { "c" => nil }] }] }, '{"a":[1,{"b":[2,{"c"') + assert_partial_value([1, [2, [3, { "x" => nil }]]], '[1,[2,[3,{"x":[') + end + def test_partial_value_issue_1005 data = <<~JSON [ diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index b4af8fa98625b8..95fc7f45536217 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -26,6 +26,19 @@ def target_thread? Thread.current == @target_thread end + # Reject trace events from other code interrupting this thread, such as + # finalizers of objects left by other tests (e.g. Tempfile's), whose + # frames are pushed on top of the interrupted frame of this file. An + # event is ours iff the innermost frame, ignoring core methods written + # in Ruby ( such as Kernel#tap), belongs to this file. + # + # +locations+ must be the caller_locations captured directly in the + # trace handler; capturing it here would add this method's own frame. + def event_from_this_file?(locations) + innermost = locations.drop_while{|loc| loc.path.start_with?("), - # belongs to this file. - innermost = caller_locations.drop_while{|loc| loc.path.start_with?("