Граф коммитов

66504 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 2b17d2f297 [ruby/net-protocol] Get rid of `__send__`
Mitigate the security risk:
https://devcraft.io/2021/01/07/universal-deserialisation-gadget-for-ruby-2-x-3-x.html

https://github.com/ruby/net-protocol/commit/a9970437e8
2021-06-16 22:23:46 +09:00
Nobuyoshi Nakada f4640f64a4
Fixed comments in cmd.exe script [ci skip] 2021-06-16 14:31:02 +09:00
Nobuyoshi Nakada f136c1ec80
Removed redundant NUM2IOCTLREQ definition [Bug #17759]
Fix up c2d9967f78.
2021-06-16 13:33:56 +09:00
Nobuyoshi Nakada c2d9967f78 Configure ioctl request argument type [Bug #17759] 2021-06-16 13:17:19 +09:00
git d4db18d6ad * 2021-06-16 [ci skip] 2021-06-16 00:09:02 +09:00
Nobuyoshi Nakada 43ed1e68a1
Make ext directory before extinit.c when out-of-place build 2021-06-16 00:08:28 +09:00
Nobuyoshi Nakada d09f097eec
Time#getlocal tests for [Feature #17544] 2021-06-15 21:42:55 +09:00
Nobuyoshi Nakada b32e6c168a
Convert initial contents before allocating queue buffer 2021-06-15 15:55:52 +09:00
Marc-Andre Lafortune f0818982e9 [ruby/ostruct] v0.4.0
https://github.com/ruby/ostruct/commit/8534f69e4e
2021-06-15 12:04:05 +09:00
Eileen M. Uchitelle 2088a45798
[Bug #17880] Set leaf false on opt_setinlinecache (#4565)
This change fixes the bug described in https://bugs.ruby-lang.org/issues/17880.

Checking `ractor_shareable_p` will cause the method to call back into
Ruby. Anything calling this method can't be a leaf instruction,
otherwise it could crash. By adding `attr bool leaf = false` we no
longer crash because it marks the function as not a leaf.

Here's a simplified reproduction script:

```ruby
require "set"

class Id
  attr_reader :db_id
  def initialize(db_id)
    @db_id = db_id
  end

  def ==(other)
    other.class == self.class && other.db_id == db_id
  end
  alias_method :eql?, :==

  def hash
    10
  end

  def <=>(other)
    db_id <=> other.db_id if other.is_a?(self.class)
  end
end

class Namespace
  IDS = Set[
    Id.new(1).freeze,
    Id.new(2).freeze,
    Id.new(3).freeze,
    Id.new(4).freeze,
  ].freeze

  class << self
    def test?(id)
      IDS.include?(id)
    end
  end
end

p Namespace.test?(Id.new(1))
p Namespace.test?(Id.new(5))
```

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-06-14 17:34:57 -07:00
Marc-Andre Lafortune a09ddfc420 [lib/ostruct] Fix YAML test 2021-06-14 12:28:53 -04:00
Marc-Andre Lafortune 52369fc545 [lib/ostruct] Allow overriding of `block_given?` 2021-06-14 12:28:53 -04:00
git fc98602ecc * 2021-06-15 [ci skip] 2021-06-15 00:04:05 +09:00
Nobuyoshi Nakada edbe0e224c
Suppress exception report in inner thread 2021-06-15 00:03:05 +09:00
Nobuyoshi Nakada 57eaa07ba6
Close leaked file descriptors 2021-06-15 00:02:15 +09:00
Nobuyoshi Nakada 5dde13e5ce [ruby/ostruct] bump up
https://github.com/ruby/ostruct/commit/bb253be3e9
2021-06-14 23:31:49 +09:00
Nobuyoshi Nakada 70833fab7f
Suppress gcc11 clobbered warning 2021-06-14 23:24:17 +09:00
jfrazx 931ea7cfbe
Add fallback block to `OpenStruct#delete_field` (#1409) 2021-06-14 09:53:20 -04:00
卜部昌平 90cad6e147 prefer cc/gcc over clang on solaris
requested by tankf33der at https://bugs.ruby-lang.org/issues/17949#change-92430
2021-06-14 22:37:17 +09:00
Nobuyoshi Nakada b513fc2fe7
Fixed method names in exception messages
These methods are not !-suffixed, and the messages were very
confusing.
2021-06-14 21:16:43 +09:00
Bruno Sutic 1ab71a5b98 Fix fiber scheduler address resolve solaris tests 2021-06-14 22:09:23 +12:00
Samuel Williams 25921fe1d6 Revert "Suppress gcc11 clobbered warning"
This reverts commit f0f9e77b65.
2021-06-14 22:07:59 +12:00
Samuel Williams 050a895439
Wake up join list within thread EC context. (#4471)
* Wake up join list within thread EC context.

* Consume items from join list so that they are not re-executed.

If `rb_fiber_scheduler_unblock` raises an exception, it can result in a
segfault if `rb_threadptr_join_list_wakeup` is not within a valid EC. This
change moves `rb_threadptr_join_list_wakeup` into the thread's top level EC
which initially caused an infinite loop because on exception will retry. We
explicitly remove items from the thread's join list to avoid this situation.

* Verify the required scheduler interface.

* Test several scheduler hooks methods with broken `unblock` implementation.
2021-06-14 17:56:53 +12:00
Nobuyoshi Nakada 626427c2e0
Removed no longer used variables 2021-06-14 14:11:38 +09:00
Nobuyoshi Nakada 635e1c5282
Pack values to preserve 2021-06-14 14:10:21 +09:00
Nobuyoshi Nakada f0f9e77b65
Suppress gcc11 clobbered warning 2021-06-14 14:09:43 +09:00
Samuel Williams 2792acc8f2
Add scheduler hook `Addrinfo.getaddrinfo`. (#4375)
Co-authored-by: Bruno Sutic <code@brunosutic.com>
2021-06-14 16:21:08 +12:00
Yusuke Endoh 688b217706 time.c: Check if defined(RUBY_MSVCRT_VERSION) to build on Solaris
Fixes [Bug #17947]
2021-06-14 10:40:41 +09:00
git 09ea2bb040 * 2021-06-14 [ci skip] 2021-06-14 10:09:30 +09:00
Yusuke Endoh 70313ec01a parse.y: Fix the location of a target constant of OP_CDECL
```
p RubyVM::AbstractSyntaxTree.parse("::Foo += 1").children
 #=> before: [[], nil, (OP_CDECL@1:0-1:10 (COLON3@1:0-1:10 :Foo) :+ (LIT@1:9-1:10 1))]
 #=> after:  [[], nil, (OP_CDECL@1:0-1:10 (COLON3@1:0-1:5 :Foo) :+ (LIT@1:9-1:10 1))]
```
2021-06-14 10:02:02 +09:00
Nobuyoshi Nakada 32b18fe9d0
Suppress array-parameter warnings by gcc 11 2021-06-13 15:12:45 +09:00
Nobuyoshi Nakada 9ab6d39a66
Added parentheses to silence sizeof-array-div warnings
As well as 2366c68116.
2021-06-13 15:12:45 +09:00
Nobuyoshi Nakada 9ec6c83c97
Removed duplicate include 2021-06-13 15:12:45 +09:00
Nobuyoshi Nakada 122ce52e8f
Check if alternative malloc header can work in C++
jemalloc (5.2.1 at least) cannot compile in C++ on macOS SDK, due
to conflicts on exception specification.
2021-06-13 15:12:45 +09:00
git cba92b3289 * 2021-06-13 [ci skip] 2021-06-13 13:45:07 +09:00
S.H d54f74a48b
Refactor rb_block_call function
rb_block_call and rb_block_call_kw have similar code.
So, using rb_block_kw function in rb_block_call function for refactoring.
2021-06-13 13:44:46 +09:00
git 146721ef6a * 2021-06-12 [ci skip] 2021-06-12 20:17:25 +09:00
nagachika 8366506de1 cont.c: Replace "iff" with "if and only if" 2021-06-12 20:15:08 +09:00
git 9210f8df7f * 2021-06-11 [ci skip] 2021-06-11 08:31:51 +09:00
Aaron Patterson d74e5d5b4f
Crash more nicely when the VM isn't fully set up
If we crash but the VM isn't fully alive, we can get an infinite loop.
2021-06-10 16:31:29 -07:00
Peter Zhu 929cc615a7 Finish GC before calling gc_set_initial_pages
If we are during incremental sweeping when calling gc_set_initial_pages
there is an assertion error. The following patch will artificially
produce the bug:

```
diff --git a/gc.c b/gc.c
index c3157dbe2c..d7282cf8f0 100644
--- a/gc.c
+++ b/gc.c
@@ -404,7 +404,7 @@ int ruby_rgengc_debug;
  * 5: show all references
  */
 #ifndef RGENGC_CHECK_MODE
-#define RGENGC_CHECK_MODE  0
+#define RGENGC_CHECK_MODE  1
 #endif
 // Note: using RUBY_ASSERT_WHEN() extend a macro in expr (info by nobu).
@@ -10821,6 +10821,10 @@ gc_set_initial_pages(void)
 void
 ruby_gc_set_params(void)
 {
+    for (int i = 0; i < 10000; i++) {
+        rb_ary_new();
+    }
+
     /* RUBY_GC_HEAP_FREE_SLOTS */
     if (get_envparam_size("RUBY_GC_HEAP_FREE_SLOTS", &gc_params.heap_free_slots, 0)) {
        /* ok */
```

The crash looks like:

```
Assertion Failed: ../gc.c:2038:heap_add_page:!(heap == heap_eden && heap->sweeping_page)
```
2021-06-10 10:59:32 -04:00
Takashi Kokubun d281fc525d
Add missing dependencies
https://github.com/ruby/ruby/runs/2791163586?check_suite_focus=true
2021-06-10 00:53:28 -07:00
Takashi Kokubun 474f79958b
Cast jit_func for Windows
https://ci.appveyor.com/project/ruby/ruby/builds/39542385/job/8b7aq951f9t01x4x
2021-06-10 00:40:59 -07:00
Takashi Kokubun c5e8a49bde
Avoid enqueueing the same ISeq twice
by a race condition by multiple Ractors.

Atmically incrementing body->total_calls may have its own cost, so for
now we intentionally leave the unreliable total_calls. So we allow an
ISeq to be never pushed when you use multiple Ractors. However, if you
enqueue a single ccan node twice, get_from_list loops infinitely. Thus
this patch takes care of such a situation.
2021-06-10 00:32:24 -07:00
Nobuyoshi Nakada 791d7d4947
Freeze command line script 2021-06-10 15:15:35 +09:00
Peter Zhu 8a46b480a7 Refactor gc_marks_start_heap to only configure heap
Move the non-heap related configurations to gc_marks_start.
2021-06-09 14:16:39 -04:00
git fa340dd9f1 * 2021-06-10 [ci skip] 2021-06-10 00:17:15 +09:00
Jun Aruga f7741cda32 Enable Travis on the specific branches or forked repositories.
Align the Travis enabling timing with GitHub Actions.

For the syntax, see <https://docs.travis-ci.com/user/conditions-v1>.
We use `repo` syntax rather than `fork = true/false` syntax to show a general usage in any repositories on GitHub.
The non-forked repo is not always a primary repo in any GitHub repositories.

[Bug #17936]
2021-06-09 17:16:53 +02:00
Nobuyoshi Nakada e03bf76b31
Pack iseq_inline_constant_cache_entry
Reordered iseq_inline_constant_cache_entry members not to exceed
the size of RValue.
2021-06-09 19:15:57 +09:00
Nobuyoshi Nakada 9ba335e2eb
[Win32] fixed PACKED_STRUCT_UNALIGNED on x86
Use MACHINE for x86 CPU family, ARCH is CPU model name (i386) and
cannot be x86.
2021-06-09 18:49:14 +09:00