Commit graph

20692 commits

Author SHA1 Message Date
Yusuke Endoh
15bb571730 test/resolv/test_dns.rb: Keep UDPSockets until a free port is found
Follow up to 589f1978d8

I suspect `UDPSocket.new` grabs the same port number because they are
closed at each trial.
2024-10-10 14:44:51 +09:00
Yuta Saito
63f94e12fb Revert "TestProcess#test_daemon_noclose is only working with macOS 15.1 beta, we should skip with macOS 15.0"
This reverts commit 3830bca5ed.
2024-10-10 13:40:59 +09:00
Nobuyoshi Nakada
e00b746b75
Suppress warnings with RUBYPOT=-w
```
-:3: warning: assigned but unused variable - var
-:3: warning: assigned but unused variable - var
-:3: warning: assigned but unused variable - var
-:3: warning: assigned but unused variable - var
-:3: warning: assigned but unused variable - var
-:3: warning: assigned but unused variable - var
```
2024-10-10 13:23:07 +09:00
Hiroshi SHIBATA
a1db8dbe16
Commented out to print fiddle version 2024-10-10 13:20:49 +09:00
Thomas Marshall
5792bd7149 Emit warning for other method redefinition types
This commit ensures warnings about `object_id` and `__send__` method
redefinitions are emitted for other method types such as aliases, procs,
and attr readers—anything except C functions.
2024-10-10 12:53:11 +09:00
Yusuke Endoh
a985695b9e Make test_hash_symbol_colon_key pass on LANG=en_US
It failed on a platform with LANG=en_US
```
  1) Failure:
PPTestModule::PPSingleLineTest#test_hash_symbol_colon_key [/home/chkbuild/chkbuild/tmp/build/20241010T010005Z/ruby/test/test_pp.rb:207]:
<"{a: 1, a!: 1, a?: 1, \u3042: 1}"> expected but was
<"{a: 1, a!: 1, a?: 1, \"\\u3042\": 1}">.
```
2024-10-10 12:23:18 +09:00
Sutou Kouhei
f1a94a497b [ruby/fiddle] test jruby: fix a typo
d76c87b804
2024-10-10 10:06:10 +09:00
Sutou Kouhei
da3c408723 [ruby/fiddle] test jruby: fix a wrong message
00b3521f5e
2024-10-10 10:06:09 +09:00
Sutou Kouhei
d7fc90d213 [ruby/fiddle] test jruby: fix a typo
5bc55e0533
2024-10-10 10:06:08 +09:00
Sutou Kouhei
a47f153d9d
Import JRuby implementation (#147)
Fix GH-104

lib/fiddle/jruby.rb is based on

https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/fiddle/jruby.rb
.

Here are changes for it:

* Move `Fiddle::TYPE_*` to `Fiddle::Types::*`
* Add `Fiddle::Types::VARIADIC`
* Add `Fiddle::Types::CONST_STRING`
* Add `Fiddle::Types::BOOL`
* Add `Fiddle::Types::INT8_T`
* Add `Fiddle::Types::UINT8_T`
* Add `Fiddle::Types::INT16_T`
* Add `Fiddle::Types::UINT16_T`
* Add `Fiddle::Types::INT32_T`
* Add `Fiddle::Types::UINT32_T`
* Add `Fiddle::Types::INT64_T`
* Add `Fiddle::Types::UINT64_T`
* Add more `Fiddle::ALIGN_*` for the above new `Fiddle::Types::*`
* Add more `Fiddle::SIZEOF_*` for the above new `Fiddle::Types::*`
* Add support for specifying type as not only `Fiddle::Types::*` but
also `Symbol` like `:int`
* Add support for variable size arguments in `Fiddle::Function`
* Add `Fiddle::Closure#free`
* Add `Fiddle::Closure#freed?`
* Add `Fiddle::Error` as base the error class
* Add `Fiddle::Pointer#call_free` and stop using `FFI::AutoPointer` in
`Fiddle::Pointer`
* Add support for `Fiddle::Pointer.malloc {}` `Fiddle::Pointer`
* Add support for `Fiddle::Pointer#free=`
* Add `Fiddle::Pointer#freed?`
* Use binary string not C string for `Fiddle::Pointer#[]`
* Add `Fiddle::Handle.sym_defined?`
* Add `Fiddle::Handle#sym_defined?`
* Add `Fiddle::Handle::DEFAULT`
* Add `Fiddle::ClearedReferenceError`
* Add no-op `Fiddle::Pinned`

Some features are still "not implemented". So there are some "omit"s for
JRuby in tests.
2024-10-10 10:05:52 +09:00
Kevin Newton
e39e582594 [ruby/prism] Attempt to assume binary is UTF-8
343197e4ff
2024-10-09 15:42:23 +00:00
David Rodríguez
2e2a5e4ff9 [rubygems/rubygems] Remove unused variable
b31f33d55c
2024-10-09 15:31:47 +00:00
ydah
1c762d9566 [Bug #20789] Fix an invalid syntax error when ->a=1...{}
https://bugs.ruby-lang.org/issues/20789
2024-10-09 23:58:19 +09:00
Vinicius Stock
e50754fcfa [ruby/prism] Avoid breaking code units offset on binary encoding
25a4cf6794

Co-authored-by: Kevin Newton <kddnewton@users.noreply.github.com>
2024-10-09 14:07:10 +00:00
David Rodríguez
48410af53c [rubygems/rubygems] Fix a gem install crash during "done installing" hooks
It would happen when the gem is already installed to multiple GEM_PATHS.
RubyGems was removing duplicate specs without considering the
potentially different `base_dir`. That was causing the gem to be
misidentified as not already installed, and a nil specification getting
returned from the installer as a result, causing the crash.

Solve it by making sure `Gem::Specification.all` really iterates through
all the different specifications in all GEM_PATHs.

0d8c208f65
2024-10-09 10:07:11 +00:00
David Rodríguez
9f812522f5 [rubygems/rubygems] Allow gem pristine to reset default gems too
c9e665eb8a
2024-10-09 06:21:30 +00:00
Hiroshi SHIBATA
4eda289a13 Sync from ruby/win32-registry 2024-10-09 13:55:45 +09:00
Hiroshi SHIBATA
589f1978d8 mingw environment can't bind free port with 10 times. We should omit it instead of test failure.
```
 1) Error:
  TestResolvDNS#test_multiple_servers_with_timeout_and_truncated_tcp_fallback:
  Errno::EACCES: Permission denied - bind(2) for "127.0.0.1" port 59677
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:78:in 'TCPServer#initialize'
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:78:in 'TCPServer.new'
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:78:in 'TestResolvDNS#with_udp_and_tcp'
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:711:in 'TestResolvDNS#test_multiple_servers_with_timeout_and_truncated_tcp_fallback'

    2) Error:
  TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback:
  Errno::EACCES: Permission denied - bind(2) for "127.0.0.1" port 59689
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:78:in 'TCPServer#initialize'
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:78:in 'TCPServer.new'
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:78:in 'TestResolvDNS#with_udp_and_tcp'
      D:/a/ruby/ruby/src/test/resolv/test_dns.rb:223:in 'TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback'
```
2024-10-09 11:28:40 +09:00
Hiroshi SHIBATA
63149cad81 Specify use_ipv6 option for ipv4 test 2024-10-08 15:52:49 +09:00
Hiroshi SHIBATA
fe33475605 Removed trailing space 2024-10-08 14:10:05 +09:00
Jean Boussier
718c4f7e1e JSONPure: String#to_json should raise on invalid encoding
Fix: #344

This matches the ext behavior.
2024-10-08 14:10:05 +09:00
Jean Boussier
8fdd3d0ed6 JSON::Pure fix strict mode
Followup: https://github.com/flori/json/pull/519
Fix: https://github.com/flori/json/issues/584
2024-10-08 14:10:05 +09:00
Jean Boussier
8c7e291dd8 Update references to flori/json
Now that the repository was transfered, these links will become
dead in a few months.
2024-10-07 20:12:57 -04:00
Kevin Newton
4cbd2ab9d4 [ruby/prism] Properly handle non-assoc operators
dbd5c929d6
2024-10-07 17:57:36 +00:00
Kevin Newton
8d1906e8b7 [ruby/prism] Handle invalid commas in arguments, parameters, and arrays
023e894b74
2024-10-07 16:38:16 +00:00
Andrew Konchin
8d359644e7 [ruby/prism] Set contains_keywords flag for implicit gets($/, chomp: true) method call to handle -l CLI option
717e41c87d
2024-10-07 15:52:22 +00:00
Nobuyoshi Nakada
773d140f65
[Bug #20787] Check the separator in IO#readline as well as 3.2 2024-10-07 11:06:44 +09:00
tomoya ishida
0752fff215 [ruby/reline] Add cursor keys for application keypad mode to default
key bindings
(https://github.com/ruby/reline/pull/719)

* Add SS3 arrow sequence to default key bindings

* Remove wrong KDE arrow sequence

546a42522e
2024-10-07 00:37:33 +00:00
tomoya ishida
8f5abcb0c7 [ruby/reline] Allow utf-8 safe meta key mapping in inputrc
(https://github.com/ruby/reline/pull/723)

Readline's convert-meta setting is utf-8 unsafe.
Allow assigning `"\M-char": key` to bind "\echar": key even if convert-meta is not enabled.

9844b99c6e
2024-10-06 23:35:06 +00:00
tomoya ishida
98620f6c52 [ruby/irb] Change default completor from regexp to auto, try
TypeCompletor and fallback to RegexpCompletor.
(https://github.com/ruby/irb/pull/1010)

bb6a99d815
2024-10-06 11:10:12 +00:00
Nobuyoshi Nakada
802445487e [ruby/reline] Fix tempfile leaks
(https://github.com/ruby/reline/pull/757)

3110469933 (step):13:1064
```
Children under /tmp/rubytest.m48l5o:
* -rw------- 1 101 2024-10-02 17:43:51 +0000 rubyfile20241002-60503-bhbfgq
```

1287f97a6f
2024-10-05 17:02:51 +00:00
Nobuyoshi Nakada
e6fa7c3544 [ruby/reline] Hash#inspect style has changed in ruby 3.4
[[Bug #20433]](https://bugs.ruby-lang.org/issues/20433)

ca457ffb70
2024-10-05 16:55:26 +00:00
Nobuyoshi Nakada
a6da8d69e6 [ruby/irb] Hash#inspect style has changed in ruby 3.4
[[Bug #20433]](https://bugs.ruby-lang.org/issues/20433)

ecd08a527e
2024-10-05 15:55:40 +00:00
Nobuyoshi Nakada
d17edf3a17
[Bug #20705] Update strtod implementation
The absence of either the integer or fractional part should be
allowed.
2024-10-05 23:29:42 +09:00
tompng
6743e6285a [Bug #20784] Fix incomplete character syntax followed by EOF 2024-10-05 15:59:01 +09:00
tomoya ishida
563263a91c [ruby/reline] Concatenate some rendeing test
(https://github.com/ruby/reline/pull/749)

41b54140f4
2024-10-04 21:56:10 +00:00
Kevin Newton
30038656aa Fix intermediate array off-by-one error
Co-authored-by: Adam Hess <HParker@github.com>
2024-10-04 15:04:26 -04:00
Kevin Newton
75640037bf [ruby/prism] Fix up multi target parsing
80cd335222
2024-10-04 16:22:21 +00:00
schneems
3c54b8e920 Allow method chaining with Pathname#mkpath
Currently in my code when I want to create a pathname object and create a path at the same time I must use tap

```
path = Pathname.new("/tmp/new").tap(&:mkpath)
```

I think it would be cleaner to be able to chain on the results of these methods instead:

```
path = Pathname.new("/tmp/new").mkpath
```
2024-10-04 12:21:27 +09:00
schneems
08346e7267 Introduce Pathname.mktmpdir
When I want to create a tmpdir I often want to manipulate it as a pathname. By introducing Pathname.mktmpdir I can get this behavior. 

Currently I must:

```ruby
Dir.mktmpdir do |dir|
  dir = Pathname(dir)
  # ... code
end
```

I would like to be able to instead:

```ruby
Pathname.mktmpdir do |dir|
  # ... code
end
```
2024-10-04 11:15:33 +09:00
Matt Valentine-House
8e7df4b7c6 Rename size_pool -> heap
Now that we've inlined the eden_heap into the size_pool, we should
rename the size_pool to heap. So that Ruby contains multiple heaps, with
different sized objects.

The term heap as a collection of memory pages is more in memory
management nomenclature, whereas size_pool was a name chosen out of
necessity during the development of the Variable Width Allocation
features of Ruby.

The concept of size pools was introduced in order to facilitate
different sized objects (other than the default 40 bytes). They wrapped
the eden heap and the tomb heap, and some related state, and provided a
reasonably simple way of duplicating all related concerns, to provide
multiple pools that all shared the same structure but held different
objects.

Since then various changes have happend in Ruby's memory layout:

* The concept of tomb heaps has been replaced by a global free pages list,
  with each page having it's slot size reconfigured at the point when it
  is resurrected
* the eden heap has been inlined into the size pool itself, so that now
  the size pool directly controls the free_pages list, the sweeping
  page, the compaction cursor and the other state that was previously
  being managed by the eden heap.

Now that there is no need for a heap wrapper, we should refer to the
collection of pages containing Ruby objects as a heap again rather than
a size pool
2024-10-03 21:20:09 +01:00
Kevin Newton
568511f393 [ruby/prism] Handle single global variable character name
7a0af49997
2024-10-03 17:43:11 +00:00
Kevin Newton
f8568fbd7f [ruby/prism] Pop lex mode for heredocs in the lexer, not the parser
5dd36b979e
2024-10-03 17:30:20 +00:00
Peter Zhu
77db37813a Fix indentation in test_after_gc_start_hook_with_GC_stress 2024-10-03 11:58:20 -04:00
tomoya ishida
ac0a8c6230 [ruby/reline] Make rendering test faster using updated yamatanooroti
(https://github.com/ruby/reline/pull/747)

7534f7f92a
2024-10-03 15:52:34 +00:00
Jeremy Evans
9986a7c393 Make Object#singleton_method return methods in modules included in or prepended to singleton class
To simplify the implementation, this makes Object#singleton_method
call the same method called by Object#method (rb_obj_method), then
check that the returned Method is defined before the superclass of the
object's singleton class.  To keep the same error messages, it rescues
exceptions raised by rb_obj_method, and then raises its own exception.

Fixes [Bug #20620]
2024-10-03 07:27:01 -07:00
Samuel Williams
cd96af2cb8
Add IO::Buffer tests for read and write with length & offset. (#11779) 2024-10-03 12:29:16 +00:00
tomoya ishida
218445bb1f [ruby/rdoc] Fix ToRdoc#accept_table
(https://github.com/ruby/rdoc/pull/1184)

7b68545094
2024-10-03 12:27:43 +00:00
Nobuyoshi Nakada
9d4af312bd [ruby/reline] Rename matches? as match?
(https://github.com/ruby/reline/pull/753)

9230fe162d
2024-10-03 10:38:38 +00:00
tompng
af1c356c7b Update default gem test for colon-style hash inspect 2024-10-03 18:47:09 +09:00