Commit graph

89125 commits

Author SHA1 Message Date
Yusuke Endoh
8aeb67de7d Remove a useless condition expression
`len` is always at least 1 here.
2024-11-30 00:03:07 +09:00
卜部昌平
705714be3e prefer ruby_memerror instead
This could be out of GVL
2024-11-29 23:19:05 +09:00
卜部昌平
25ad7e8e6c rb_gc_impl_malloc can return NULL
Let there be rooms for each GC implementations how to handle multi
threaded situations.  They can be totally reentrant, or can have
their own mutex, or can rely on rb_thread_call_with_gvl.

In any ways the allocator (has been, but now officially is)
expected to run properly without a GVL.  This means there need be
a way for them to inform the interpreter about their allocation
failures, without relying on raising exceptions.

Let them do so by returning NULL.
2024-11-29 23:19:05 +09:00
git
5067a46502 Update default gems list at ae85fc7271 [ci skip] 2024-11-29 10:28:26 +00:00
Akinori MUSHA
ae85fc7271 [ruby/set] Bump VERSION to 1.1.1
1c3cded76a
2024-11-29 10:27:25 +00:00
Misaki Shioi
49d2e79fb0
Ensure to close pipes when TCPSocket.new finishes processing (#12181)
`TCPSocket.new` with HEv2 uses three threads.
The last of these threads to exit closed pipes.
However, if pipes were open at the end of the main thread, they would leak.
This change avoids this by closing pipes at the end of the main thread.
2024-11-29 18:49:02 +09:00
Misaki Shioi
22e1a8c478
Allow disable to fast_fallback of TCPSocket.new (#12210)
with `Socket.tcp_fast_fallback=`
The functions that `Socket.tcp` had are now also available in `TCPSocket.new`.
2024-11-29 14:18:09 +09:00
Yusuke Endoh
f9d0bc22f5 Remove a useless check if fd is negative
If `slave` is negative, neither `dup2(slave,0)` or `close(slave)` should
be executed. I believe this check is completely useless.
2024-11-29 12:38:20 +09:00
Yusuke Endoh
a32981b6b8 Remove a useless check
Here `nb` should never be NULL. If it were, the following
`nb->buffer_list` would be strange.

A follow-up to ddd8da4b6b
2024-11-29 12:27:04 +09:00
Nobuyoshi Nakada
43dd9c721f [ruby/date] Fix mixed declarations and code
This still support ruby 2.6 which does not require C99.

61d849758f
2024-11-29 02:48:10 +00:00
Nobuyoshi Nakada
b910de641b [ruby/date] Suppress compound-token-split-by-macro warnings
It was used intentionally.

291b40f939
2024-11-29 02:48:09 +00:00
Nobuyoshi Nakada
ad773b5e99 [ruby/time] [DOC] Make RDoc coverage 100%
c668704413
2024-11-29 01:39:01 +00:00
Hiroshi SHIBATA
84b14c0385 Dont't need to run nmake test 2024-11-29 09:49:07 +09:00
Hiroshi SHIBATA
c392bec8cc Use only -j option for test option 2024-11-29 09:49:07 +09:00
Hiroshi SHIBATA
60fa8ec701 nmake check is working now with Windows platform 2024-11-29 09:49:07 +09:00
Nobuyoshi Nakada
a1500eefdb
Remove document file needless for ruby core
This reverts commit 743a31d639,
"[ruby/date] [DOC] Make document coverage 100%".  This file is only
for rdoc coverage in the date gem, and useless when the built-in Time
is documented.
2024-11-29 09:13:51 +09:00
John Hawthorn
a5119a3f27 YJIT: Add missing prepare before calling str_dup 2024-11-28 15:04:12 -05:00
Yusuke Endoh
50a34637a4 Avoid illegal pointer
When loading a crafted marshal data of Random, a pointer to an illegal
address was created. I don't think there is any harm since the data is
normalized before access, but just to be safe, I add a check to make it
an error.
2024-11-29 03:01:46 +09:00
Peter Zhu
803eed6943 Add commit 2da9238 to .git-blame-ignore-revs [ci skip] 2024-11-28 11:35:24 -05:00
Peter Zhu
2da92388b9 Expand tabs in addr2line.c
.git-blame-ignore-revs will be updated after this commit is merged.
2024-11-28 11:34:38 -05:00
David Rodríguez
bd88cffd8c [rubygems/rubygems] Test with Ruby 3.4
23d06195fa
2024-11-28 15:52:16 +00:00
git
3e308971ef Update default gems list at afea58a0ef [ci skip] 2024-11-28 15:23:35 +00:00
Mari Imaizumi
afea58a0ef [ruby/reline] Bump version to 0.5.12
(https://github.com/ruby/reline/pull/786)

d4f6741e7e
2024-11-28 15:22:40 +00:00
Misaki Shioi
47f8a552f6
Ensure to free fast_fallback_getaddrinfo_shared with single family (#12199)
With https://github.com/ruby/ruby/pull/12156,
the memory of the `struct fast_fallback_getaddrinfo_shared`
is now allocated even if there is only one address family.
This change will always free it when `TCPSocket.new` finishes.
2024-11-28 22:39:35 +09:00
Yusuke Endoh
3af1a04741 [ruby/prism] Fix a copy-paste error
This is not important because of the path of `assert(false)`, but just
in case.

Coverity Scan found this issue.

7335c62f9d
2024-11-28 12:38:16 +00:00
Stan Lo
36ed9c2fc9 [ruby/rdoc] Improve how gemspec's files are defined
(https://github.com/ruby/rdoc/pull/1212)

Currently, the gemspec's files are defined by hand, which is error-prone.

For example: https://github.com/ruby/rdoc/pull/1211

This commit uses `Dir.glob` where possible to reduce the risk of that
happening again.

- Additional files added with this approach:

    ```
    # This should have been added by only captured by this commit
    lib/rdoc/parser/prism_ruby.rb

    # These are folders and can be included/ignored either way
    lib/rdoc/generator/template/darkfish
    lib/rdoc/generator/template/darkfish/css
    lib/rdoc/generator/template/darkfish/fonts
    lib/rdoc/generator/template/darkfish/images
    lib/rdoc/generator/template/darkfish/js
    lib/rdoc/generator/template/json_index
    lib/rdoc/generator/template/json_index/js
    ```

- Files that are ignored after this change:

    ```
    # They make no difference on documentation generation
    # Probably can be removed
    lib/rdoc/generator/template/darkfish/.document
    lib/rdoc/generator/template/json_index/.document
    ```

ac2a151f10
2024-11-28 12:18:11 +00:00
Nobuyoshi Nakada
de89bff122
INIT_ANCHOR no longer needed usually 2024-11-28 19:02:56 +09:00
Nobuyoshi Nakada
b8f248ee5a
Initialize LINK_ANCHOR totally 2024-11-28 18:53:10 +09:00
ydah
31a3e87777 [DOC] typo fix in NEWS.md
follow up: https://github.com/ruby/ruby/pull/12196/files#r1861730753
2024-11-28 18:19:02 +09:00
Koichi Sasada
da2c083fca add a NEWS entry about extra rescue/ensure frames
from backtraces.
2024-11-28 17:36:31 +09:00
Koichi Sasada
2f870b651a add NEWS entries about Ractor related changes. 2024-11-28 17:36:31 +09:00
Nobuyoshi Nakada
319ac31529
Assert that non-empty LINK_ANCHOR does not loop
After any `LINK_ELEMENT` sequence is added, `LINK_ANCHOR` must not
loop.
2024-11-28 15:13:52 +09:00
Hiroshi SHIBATA
84bf0b3774 Always declared gems that are test failures on Windows to allowed failures list 2024-11-28 14:56:46 +09:00
Hiroshi SHIBATA
03d9dfa60c Exclude successful gems from TEST_BUNDLED_GEMS_ALLOW_FAILURES 2024-11-28 14:56:46 +09:00
Hiroshi SHIBATA
54c8265dab Skip test-all on nmake test-bundled-gems 2024-11-28 14:56:46 +09:00
Hiroshi SHIBATA
227791acb1 Try to run nmake test-bundled-gems in Windows platform 2024-11-28 14:56:46 +09:00
Yusuke Endoh
38f76cb57a Avoid an operation on a pointer after free
A follow-up to ef59175a68. That commit
uses `&body->local_table[...]` but `body->local_table` is already freed.
I think it is an undefined behavior to calculate a pointer that exceeds
the bound by more than 1.

This change moves the free of `body->local_table` after the calculation.

Coverity Scan found this issue.
2024-11-28 14:49:37 +09:00
Yusuke Endoh
c0e607cef1 Fix a possible leak of a file descriptor
The same issue as https://github.com/ruby/prism/pull/3246

Coverity Scan found this issue.
2024-11-28 13:26:26 +09:00
git
d94ae8b8f9 Update bundled gems list at e0b68b2dc9 [ci skip] 2024-11-28 03:25:04 +00:00
Hiroshi SHIBATA
e0b68b2dc9 Bump up test-unit 3.6.4
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2024-11-28 12:24:17 +09:00
Hiroshi SHIBATA
f90f4735c9 Update bundled_gems 2024-11-28 12:24:17 +09:00
Hiroshi SHIBATA
1a8f1379bc
Skip failure tests with Windows platform 2024-11-28 12:23:56 +09:00
Yusuke Endoh
29e90a598a [ruby/prism] Fix a possible leak of a file descriptor
When mmap fails for any reason, the fd must be closed.

Coverity Scan found this issue.

c06e9c400f
2024-11-28 02:15:25 +00:00
Peter Zhu
7dd2afbe3a Fix global-buffer-overflow when outputting C backtrace
fill_lines is passed -1 for offset, which causes it to read the -1 index
of traces. This is not valid memory as -1 is reading before the trace
global variable in rb_print_backtrace. This code comes from commit
99d1f5f88b, where there used to be special
handling for the -1 index.

We can see this error in ASAN:

    ==71037==ERROR: AddressSanitizer: global-buffer-overflow on address 0x00010157abf8 at pc 0x00010116f3b8 bp 0x00016f92c3b0 sp 0x00016f92c3a8
    READ of size 8 at 0x00010157abf8 thread T0
        #0 0x10116f3b4 in debug_info_read addr2line.c:1945
        #1 0x10116cc90 in fill_lines addr2line.c:2497
        #2 0x101169dbc in rb_dump_backtrace_with_lines addr2line.c:2635
        #3 0x100e56788 in rb_print_backtrace vm_dump.c:825
        #4 0x100e56db4 in rb_vm_bugreport vm_dump.c:1155
        #5 0x100734dc4 in rb_bug_without_die error.c:1085
        #6 0x100734ae4 in rb_bug error.c:109
2024-11-27 14:36:50 -05:00
tomoya ishida
34a43d5972 [ruby/reline] Fix io_gate.encoding raises IOError in ruby <= 3.0
(https://github.com/ruby/reline/pull/785)

85e20f0031
2024-11-27 18:51:04 +00:00
tomoya ishida
33c6bbca22 [ruby/reline] fix/omit test that fail in encoding=US_ASCII
(https://github.com/ruby/reline/pull/784)

a6d1ac54e6
2024-11-27 18:36:57 +00:00
Peter Zhu
0af2eafc59 Fix C level backtrace info on macOS clang 16
macOS clang 16 generates DWARF5, which have Mach-O section names that
are limited to 16 characters, which causes sections with long names to
be truncated and not match above.

See: https://wiki.dwarfstd.org/Best_Practices.md#Mach-2d-O
2024-11-27 12:12:23 -05:00
Nobuyoshi Nakada
3354324c6e Move Kernel#with_yjit to Module#with_yjit 2024-11-27 09:04:07 -08:00
Peter Zhu
14ce2443db Make rb_bug_without_die static
It's not used outside of error.c.
2024-11-27 11:32:58 -05:00
Yusuke Endoh
209f8ba7c4 [ruby/json] Prevent a warning of "a candidate for gnu_printf format attribute"
GCC 13 prints the following warning.

20241127T001003Z.log.html.gz
```
compiling generator.c
generator.c: In function ‘raise_generator_error’:
generator.c:91:5: warning: function ‘raise_generator_error’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
   91 |     VALUE str = rb_vsprintf(fmt, args);
      |     ^~~~~
```

This change prevents the warning by specifying the format attribute.

b8c1490846
2024-11-27 23:35:20 +09:00