87509 Commits

Author SHA1 Message Date
Kevin Newton
b97ff7dfda [ruby/prism] Fix up lex difference when ~ heredoc with 0 dedent and line continuation
https://github.com/ruby/prism/commit/84a9251915
2024-09-25 18:35:05 +00:00
Kevin Newton
12cf9f2ae5 [ruby/prism] Fix up void value expression checking for rescue
https://github.com/ruby/prism/commit/509ff88e92
2024-09-25 18:34:51 +00:00
Kevin Newton
768ceceb12 [ruby/prism] Disallow label in parentheses
https://github.com/ruby/prism/commit/b624e09cc6
2024-09-25 17:33:51 +00:00
Kevin Newton
6a168fbf41 Potentially fix ASAN checks for GC-ing operand 2024-09-25 12:23:29 -04:00
Takashi Kokubun
505206b8ac
YJIT: Cache Context decoding (#11680) 2024-09-25 12:18:13 -04:00
Kevin Newton
a6ea4ddb4e [ruby/prism] Remove use of __assume to simplify
https://github.com/ruby/prism/commit/4daf58f7a0
2024-09-25 16:17:08 +00:00
Kevin Newton
bf6109c8cc [ruby/prism] Fix up windows use of __assume
https://github.com/ruby/prism/commit/9fd0c0901e
2024-09-25 16:08:13 +00:00
Kevin Newton
57688cd625 [ruby/prism] Support a max depth to protect against malicious payloads
https://github.com/ruby/prism/commit/a474017bbe
2024-09-25 15:47:08 +00:00
Peter Zhu
b77772496a Don't check poisoned for immediates 2024-09-25 11:14:14 -04:00
Peter Zhu
c32fd1b5ed Add debugging code to vm_objtostring in ASAN
To debug this issue on CI:
http://ci.rvm.jp/logfiles/brlog.trunk_asan.20240922-002945
2024-09-25 11:00:04 -04:00
Kevin Newton
ecbc4a67c9
Fix up new types for block arguments and splats in prism compiler 2024-09-25 09:52:47 -04:00
Benoit Daloze
cafd666adf [ruby/prism] Type every node field and mark on-error-only types explicitly
* For Loader.java, do not deserialize the AST if there are errors, so then Java nodes only have non-error types for fields.

https://github.com/ruby/prism/commit/ae78e3c605
2024-09-25 13:46:31 +00:00
Peter Zhu
407f8b8716 Fix memory leak in Ripper for indented heredocs
The allocated parser string is never freed, which causes a memory leak.

The following code leaks memory:

    Ripper.sexp_raw(DATA.read)

    __END__
    <<~EOF
      a
        #{1}
      a
    EOF
2024-09-25 08:56:14 -04:00
Hiroshi SHIBATA
3830bca5ed
TestProcess#test_daemon_noclose is only working with macOS 15.1 beta, we should skip with macOS 15.0 2024-09-25 17:36:03 +09:00
dependabot[bot]
76543a34ab Bump github/codeql-action from 3.26.8 to 3.26.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.8 to 3.26.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](294a9d9291...461ef6c76d)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-25 11:45:33 +09:00
Nobuyoshi Nakada
0283b5ddb4 Check syntax warnings in built-in scripts 2024-09-25 11:18:41 +09:00
Josh Cooper
0d16c36d0a [win32/registry] Fallback to UTF-8 for unknown codepages
There are some codepages like cp708 for which no ruby encoding exists:

    $ ruby -e "Encoding.find('cp708')"
    Traceback (most recent call last):
    	1: from -e:1:in `<main>'
    -e:1:in `find': unknown encoding name - cp708 (ArgumentError)

win32/registry uses ENCODING to transcode error messages and expand environment
variables from UTF-16LE, so using UTF-8 seems like the best choice and is better
than a hard failure.

This should resolve [Bug #13831]
2024-09-25 10:43:31 +09:00
Nobuyoshi Nakada
c94ea1cccb
Fix size modifier for size_t 2024-09-25 10:40:14 +09:00
ydah
509b577e01 Implement BLOCK_PASS NODE keyword locations 2024-09-25 09:15:43 +09:00
ydah
31a88d1554 Implement RETURN NODE keyword locations 2024-09-25 09:06:42 +09:00
masatoshi_moritsuka
6b46060fc2 doc: Remove description of experimental warnings related pattern matching from documentation
Ruby 3.2.0 has been released and all experimental warnings about pattern matching have been removed.
Experimental warnings about pattern matching are no longer output, so I remove description about it from documentation as well.

cf. https://bugs.ruby-lang.org/issues/18585
cf. db6b23c76cbc7888cd9a9912790c2068703afdd0
cf. https://twitter.com/k_tsj/status/1606956336037900289?s=20&t=-_PSYLhYPtYsB9FZhtXl5A
2024-09-25 07:06:42 +09:00
Kevin Newton
a80a9cf9ef Further split up pm_compile_node to work on -O0 builds 2024-09-24 17:08:17 -04:00
Burdette Lamar
d5241414c5
[DOC] More on Array#fill (#11610) 2024-09-24 16:35:43 -04:00
Jean Boussier
d31378dc91 [ruby/psych] Use String#match? over String#=~ when applicable
Save on allocating useless `MatchData` instances.

https://github.com/ruby/psych/commit/b2d9f16e58
2024-09-24 19:25:40 +00:00
Peter Zhu
e956ce32c8 Use rb_bug instead of UNREACHABLE for assertions
UNREACHABLE uses __builtin_unreachable which is not intended to be used
as an assertion.
2024-09-24 14:54:55 -04:00
Peter Zhu
c51d8ff458 Fix undefined behavior in String#append_as_bytes
The UNREACHABLE macro calls __builtin_unreachable, which according to
the [GCC docs](https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005funreachable):

> If control flow reaches the point of the __builtin_unreachable, the
> program is undefined.

But it can reach this point with the following script:

    "123".append_as_bytes("123")

This can crash on some platforms with a `Trace/BPT trap: 5`.
2024-09-24 14:54:55 -04:00
Peter Zhu
4f0fe97995 Free scope node in prism 2024-09-24 10:23:45 -04:00
Peter Zhu
4113dcc4ae Fix memory leak in constant ID list in prism 2024-09-24 10:23:45 -04:00
David Rodríguez
b48add3c65 [rubygems/rubygems] Fix bundler/inline overwriting lockfiles
This was introduced by https://github.com/rubygems/rubygems/commit/0b7be7bb7705, because
the original patch was not adapted to some recent refactorings.

https://github.com/rubygems/rubygems/commit/0bca60d6e5

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2024-09-24 14:17:23 +00:00
tomoya ishida
07842491c5 [ruby/irb] Use proper locale in history encoding test
(https://github.com/ruby/irb/pull/1008)

https://github.com/ruby/irb/commit/f6b06a9a40
2024-09-24 14:07:47 +00:00
Luke Gruber
2a0ee408af [ruby/error_highlight] Fix error with prism when method given no arguments
such as:

  p = Proc.new

This now matches the RubyVM::AbstractSyntaxTree behavior, which is
not to highlight anything.

https://github.com/ruby/error_highlight/commit/d5c592a1ba
2024-09-24 13:28:01 +00:00
Kevin Newton
414a848cc6 [ruby/prism] Accept version shorthand like 3.4
https://github.com/ruby/prism/commit/098f1c4607
2024-09-24 13:21:36 +00:00
Peter Zhu
e02a6097e6 Set node_id to -1 in add_adjust_info
add_adjust_info will increment the insns_info_index, so we need to set
the node_id to -1 to prevent a "Conditional jump or move depends on
uninitialised value" in Valgrind.
2024-09-24 08:59:15 -04:00
Kevin Newton
8edd6e606f
Update deps for prism/options.c 2024-09-24 08:37:19 -04:00
Benoit Daloze
ed4a55fc4d [ruby/prism] Accept all 3.3.x and 3.4.x Ruby versions for Prism.parse
https://github.com/ruby/prism/commit/a4fcd5339a
2024-09-24 12:24:19 +00:00
Benoit Daloze
b8baf3f3ee [ruby/prism] check_string() should always return a valid C string
* Otherwise it is invalid e.g. to call strlen() to the result,
  or to assume the argument was a string.
* All callers are already checking for nil before.

https://github.com/ruby/prism/commit/8197be883e
2024-09-24 12:24:19 +00:00
David Rodríguez
5228d349d9
[rubygems/rubygems] Restore gem_dir as an instance variable accessor
I suspect someone could be setting this instance variable, and the
previous changes made that no longer effective.

Also I implemented a previous TOOD in `full_gem_path` the other way
around:

> # TODO: This is a heavily used method by gems, so we'll need
> # to aleast just alias it to #gem_dir rather than remove it.

I made `gem_dir` an alias of `full_gem_path` rather than the opposite.

This alternative change keeps both methods symmetric without deprecating
either of them for now.

https://github.com/rubygems/rubygems/commit/28983973a3
2024-09-24 15:33:31 +09:00
David Rodríguez
5f47f0f759
[rubygems/rubygems] Remove TODO I can't make much sense of
https://github.com/rubygems/rubygems/commit/6d627e0671
2024-09-24 15:33:31 +09:00
Adam Hess
4b1e852d3e
[ruby/error_highlight] Prism added node_id and Node#breadth_first_search in the 1.0 release. These methods are required for Prism to be able to find the method from the backtrace.
https://github.com/ruby/prism/blob/main/CHANGELOG.md#100---2024-08-28

In practice you will likely only end up in this situation if you previously had pre-1.0 prism installed and upgrade Ruby to a version with Prism as the default parser.

https://github.com/ruby/error_highlight/commit/cb574daf62
2024-09-24 15:33:31 +09:00
NAITOH Jun
373f679e48 fix rb_memsearch() document
## Why?
The explanation of x and y is reversed.

ddbd644001/re.c (L251-L256)
```
long
rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
{
    const unsigned char *x = x0, *y = y0;

    if (m > n) return -1;
```
2024-09-24 15:12:48 +09:00
MSP-Greg
4956324af3 mingw.yml - fixup to use ucrt, logging 2024-09-24 15:05:14 +09:00
dependabot[bot]
fac5aa05ae Bump github/codeql-action from 3.26.7 to 3.26.8
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.7 to 3.26.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8214744c54...294a9d9291)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-24 14:18:08 +09:00
Lars Kanis
acf28e835f Windows: Use Unicode aware WinAPI function for ENV[]=
This only makes a difference when setting an empty value to a Unicode key.
2024-09-24 14:06:51 +09:00
Lars Kanis
7627a95e41 Windows: Remove ENV code targeting Windows before Vista
Windows Vista removed the limit to 32768 bytes environment block.
Also MINGW supports _wputenv_s() for years.
2024-09-24 14:06:51 +09:00
Lars Kanis
0641845a4b Windows: Remove compatibility to ancient MSVCRT API
Using _wputenv_s simplifies the code and we can avoid code duplication by using rb_w32_home_dir() to initialize ENV['HOME'].
2024-09-24 14:06:51 +09:00
Hiroshi SHIBATA
79e79afee4
Show volume details at Windows platform of GHA 2024-09-24 13:32:52 +09:00
Takashi Kokubun
48b3386f6a Fix a typo 2024-09-23 16:40:20 -07:00
Takashi Kokubun
798a115a15 Fix a -Wsign-compare warning
../time.c:5247:50: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘long unsigned int’ due to unsignedness of other operand [-Wsign-compare]
 5247 |         int w = (year >= -9999 && year <= 9999 ? year_width : (int)(year < 0) + DECIMAL_SIZE_OF(year));
      |                                                  ^~~~~~~~~~
2024-09-23 16:39:31 -07:00
Peter Zhu
fc043a2e61 Remove write barrier for non-Ruby object
enumerator's meth attribute is an ID, which is not a Ruby object, so we
should not apply the write barrier on it.
2024-09-23 15:51:16 -04:00
Peter Zhu
19c617b51d Revert "GC guard current_string in the putobject instruction"
This reverts commit 69f28ab715a02692fb2a9128bed46044963cbb50.

This commit is being reverted because it does not fix the ASAN issue in
the objtostring instruction.
2024-09-23 11:45:21 -04:00