80961 Commits

Author SHA1 Message Date
Jean Boussier
ea1b1ea1aa String#force_encoding don't clear coderange if encoding is unchanged
Some code out there blind calls `force_encoding` without checking
what the original encoding was, which clears the coderange uselessly.

If the String is big, it can be a rather costly mistake.

For instance the `rack-utf8_sanitizer` gem does this on request
bodies.
2023-11-09 12:38:10 +01:00
Jun Aruga
0a7e620a36 .travis.yml: Add arm64 case.
In the past, I saw that the 2nd arm64 pipeline was unstable. Now I want to try
it to check if it is stable enough to run again.

As far as I know, right now the only native arm64 cases are MacOS Arm
`macos-arm-oss` on GitHub Actions. And I want to add Linux arm64 case on
pull-request in CI.
2023-11-09 12:03:02 +01:00
Jean Boussier
b013aae0c6 IO#read always check the provided buffer is mutable
Otherwise you can have work in some circumstance but not in others.
2023-11-09 11:45:02 +01:00
Nobuyoshi Nakada
0f02fbd9ff Range check in pm_constant_id_lookup 2023-11-09 18:21:45 +09:00
Nobuyoshi Nakada
e824b69a86 Remove useless casts 2023-11-09 18:21:45 +09:00
TSUYUSATO Kitsune
fae44d6524 [ruby/prism] Reset do_loop_stack around a body of a endless method definition
Fix https://github.com/ruby/prism/pull/1772

https://github.com/ruby/prism/commit/cdf58e845e
2023-11-09 08:37:20 +00:00
Nobuyoshi Nakada
b73e087dbc
[DOC] Fix typos 2023-11-09 16:37:03 +09:00
Nobuyoshi Nakada
195a09cc7f [ruby/digest] Suppress implicit cast down warnings
https://github.com/ruby/digest/commit/2f3505bf3f
2023-11-09 07:20:00 +00:00
Nobuyoshi Nakada
7e8d9f49b3 [Bug #18286] Show checksum of builtin_binary.inc for confirmation 2023-11-09 16:01:01 +09:00
Nobuyoshi Nakada
22939382a8 [Bug #18286] Make builtin binary if sharable in universal binaries 2023-11-09 16:01:01 +09:00
Nobuyoshi Nakada
e2ef85b109 Finer granularity IBF dependendency
It depends on only `VALUE` definition.  Check for endianness and word
size instead of the platform name.
2023-11-09 16:01:01 +09:00
Nobuyoshi Nakada
61bb5c0572 Use uint32_t instead of unsigned int for the exact size 2023-11-09 16:01:01 +09:00
Nobuyoshi Nakada
40d40a651e Revert "Disable iseq-dumped builtin module for universal x86_64/arm64 binaries"
This reverts commit 1d5598fe0d3470e7cab06a756d40a9221fcd501b.
2023-11-09 16:01:01 +09:00
Yusuke Endoh
486b674e2a Do not allow test-all to load the bundled gems
This change prevents default gems from inadvertently depending on
bundled gems. This issue was discovered by being able to
`require "rbs"` from test/irb.
2023-11-09 14:17:13 +09:00
Ben Hamilton
1d5598fe0d Disable iseq-dumped builtin module for universal x86_64/arm64 binaries
During the build, Ruby has special logic to serialize its own builtin
module to disk using the binary iseq format during the build (I assume
for speed so it doesn't have to parse builtin every time it starts
up).

However, since iseq format is architecture-specific, when building on
x86_64 for universal x86_64 + arm64, the serialized builtin module is
written with the x86_64 architecture of the build machine, which fails
this check whenever ruby imports the builtin module on arm64:

1fdaa06660/compile.c (L13243)

Thankfully, there's logic to disable this feature for cross-compiled builds:

1fdaa06660/builtin.c (L6)

This disables the iseq logic for universal builds as well.

Fixes [Bug #18286]
2023-11-09 12:24:01 +09:00
Vít Ondruch
a168426881
[rubygems/rubygems] Make the test_build_extensions more predictable
The `test_build_extensions` make assumptions about return value of
`Gem.install_extension_in_lib`. Givent that RubyGems allow to override
this method via `defaults.rb` / `operating_system.rb`, this test might
not always pass. This change makes sure that the
`Gem.install_extension_in_lib` is predictable.

https://github.com/rubygems/rubygems/commit/e83d0a5da8
2023-11-09 10:34:48 +09:00
Vít Ondruch
5454741712
[rubygems/rubygems] Use extension_in_lib helper instead of custom code
`extension_in_lib` helper improves readibility and it also uses `stub`
on on background instead of custom code.

https://github.com/rubygems/rubygems/commit/aacc8ac22c
2023-11-09 10:34:48 +09:00
David Rodríguez
a1d0c048df
[rubygems/rubygems] Fix daily Bundler CI
Daily Bundler CI against ruby-head is failing because ruby-head now
uses bigdecimal 3.1.5, so that gets locked by this spec.

This change should make the test stable until bigdecimal 99.1.5 is
bundled with Ruby :)

https://github.com/rubygems/rubygems/commit/830326041f
2023-11-09 10:34:48 +09:00
David Rodríguez
28356c2870
[rubygems/rubygems] Explicitly pass install-dir when installing system gems in Bundler specs
We want to avoid any "user home" fallbacks, since that won't work with
Bundler.

So if there's a permissions issue during specs, it's best to raise
immediately.

https://github.com/rubygems/rubygems/commit/767a3e7533
2023-11-09 10:34:48 +09:00
David Rodríguez
f67a80cdc0
[rubygems/rubygems] No need to let this command fail
This command is not expected to fail. If it fails, we can stop the test.

https://github.com/rubygems/rubygems/commit/2511a5b093
2023-11-09 10:34:48 +09:00
David Rodríguez
d9ac2d91e0
[rubygems/rubygems] Remove unused logic
https://github.com/rubygems/rubygems/commit/2eb2860e9e
2023-11-09 10:34:48 +09:00
Matt Valentine-House
5c8d2c2d45 [PRISM] Always lookup idERROR_INFO consistently.
We know where it is in the iseq local table, because we forced it using
`iseq_set_exception_local_table` when compiling the BEGIN_NODE, so we
can always look it up from the same place.

Co-Authored-By Peter Zhu <peter@peterzhu.ca>
2023-11-08 20:28:58 -05:00
Kevin Newton
201853f4e1 [ruby/prism] Provide Parameters#signature for mirroring Method#parameters
https://github.com/ruby/prism/commit/90b3245528
2023-11-08 22:17:43 +00:00
Jemma Issroff
f9e34a1fd3 [PRISM] Add tests for OptionalKeywordParameterNode
This commit adds tests for the compilation of the
OptionalKeywordParameterNode, and fixes cases on the
RequiredKeywordParameterNode
2023-11-08 18:15:47 -03:00
Jemma Issroff
70e4ff9feb [PRISM] Added tests for ForwardingParameterNode, KeywordRestParameterNode 2023-11-08 18:15:47 -03:00
Jemma Issroff
26cff6ae2b [PRISM] Add tests for several parameters nodes
This commit adds tests for BlockParameterNode, RequiredParameterNode,
RequiredKeywordParameterNode and RestParameterNode
2023-11-08 18:15:47 -03:00
Peter Zhu
8d0eb872e8 Add foo.gemspec for failing test
foo.gemspec was added in
rubygems/rubygems@8d699ed096 but was not
sync'd in commit b4bf8c9ee2d716adf5fc08e67c4b26d6a8f929c2. This causes
the spec to fail.
2023-11-08 13:29:10 -05:00
Jeremy Evans
ddd99a5290 [ruby/tempfile] Make Tempfile#open return the underlying File
Add test for this behavior.

https://github.com/ruby/tempfile/commit/0ca31a6b8d
2023-11-08 16:47:29 +00:00
Mau Magnaguagno
eb2abc3f16
YJIT: refactor format_number (#8869)
Replace enumerators with simpler and faster version that only inserts commas before '.' or end of integer string.
2023-11-08 10:37:19 -05:00
Takashi Kokubun
50402db5a7
YJIT: Disable code GC (#8865)
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2023-11-08 10:21:04 -05:00
git
32e89b7f9c * remove trailing spaces. [ci skip] 2023-11-08 15:20:01 +00:00
Jeremy Evans
ddcfc9feab [ruby/tempfile] Fix Tempfile#{dup,clone}
Instead of storing the delegate in @tmpfile, use __getobj__, since
delegate library already handles dup/clone for that.  Copy the
unlinked, mode, and opts instance variables to the returned object
when using dup/clone.

Split the close/unlink finalizer into two finalizers. The close
finalizer always closes when any Tempfile instance is GCed, since
each Tempfile instance uses a separate file descriptor. The unlink
finalizer unlinks only when the original and all duped/cloned
Tempfiles are GCed, since all share the same path.

For Tempfile#open, undefine the close finalizer after closing the
current file, the redefine the close finalizer with the new file.

Fixes [Bug #19441]

https://github.com/ruby/tempfile/commit/dafabf9c7b
2023-11-08 15:19:52 +00:00
Burdette Lamar
d80009d169
[DOC] RDoc for module Process (#8847) 2023-11-08 09:26:27 -05:00
Adam Hess
f694bd158c Improve error and memory handling
Apply Nobu's suggestions which improve style, memory handling and error correction.

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-11-08 08:05:58 -05:00
Adam Hess
05cde4155c fix regex from regex memory corruption
before this change, creating a regex from a regex with a named capture, Regexp.new(/(?<name>)/), causes memory to be shared between the two named capture groups which can cause a segfault if the original is GCed.
2023-11-08 08:05:58 -05:00
Han Young
b4bf8c9ee2 [rubygems/rubygems] Ensure we are using the same extension dir
Since #6945 the extension dir changed to Gem::BasicSpecification's implementation, we didn't hook that in rubygems_ext.rb. So for universal rubies, we ended up using the universal platform name when installing, but arch replaced platform name when checking. This lead to native extensions can never be correctly installed on universal rubies.

Hook Gem::BasicSpecifications so the behavior is consistent on installing and checking.

https://github.com/rubygems/rubygems/commit/8d699ed096
2023-11-08 12:40:22 +00:00
Jean Boussier
7efe0669ae TypedData_Make_Struct0: cast RTYPEDDATA_GET_DATA return pointer
Fixes:

```
/usr/local/ruby/include/ruby-3.3.0+0/ruby/internal/core/rtypeddata.h:467:33:
error: invalid conversion from ‘void*’ to ‘parser_t*’ [-fpermissive]
  467 |     (sval) = RTYPEDDATA_GET_DATA(result); \
      |              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
      |                                 |
      |                                 void*
```
2023-11-08 11:33:01 +01:00
Jean Boussier
d898e8d6f8 Refactor rb_shape_transition_shape_capa out
Right now the `rb_shape_get_next` shape caller need to
first check if there is capacity left, and if not call
`rb_shape_transition_shape_capa` before it can call `rb_shape_get_next`.

And on each of these it needs to checks if we got a TOO_COMPLEX
back.

All this logic is duplicated in the interpreter, YJIT and RJIT.

Instead we can have `rb_shape_get_next` do the capacity transition
when needed. The caller can compare the old and new shapes capacity
to know if resizing is needed. It also can check for TOO_COMPLEX
only once.
2023-11-08 11:02:55 +01:00
git
4abf6cde58 Update default gems list at 8cd6c65af13ce1ce5ec1b9bd7b8a12 [ci skip] 2023-11-08 07:05:17 +00:00
Sutou Kouhei
8cd6c65af1 [ruby/stringio] Development of 3.1.0 started.
https://github.com/ruby/stringio/commit/a2f8ef1a6a
2023-11-08 07:04:15 +00:00
tomoya ishida
8da33bff8c [ruby/irb] Skip TypeCompletion test in ruby ci
(https://github.com/ruby/irb/pull/748)

https://github.com/ruby/irb/commit/d394af0bbc
2023-11-08 06:42:10 +00:00
Yusuke Endoh
7f565b923a Prevent a warning: assigned but unused variable - raised_exception 2023-11-08 15:39:19 +09:00
Nobuyoshi Nakada
4da6333615
Export functions used for builtins 2023-11-08 13:02:55 +09:00
dependabot[bot]
906f6cfe64 Bump ruby/setup-ruby from 1.159.0 to 1.160.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.159.0 to 1.160.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Commits](54a18e26db...036ef458dd)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-07 18:48:38 -08:00
tomoya ishida
e344010465 [ruby/irb] Type based completion using Prism and RBS
(https://github.com/ruby/irb/pull/708)

* Add completor using prism and rbs

* Add TypeCompletion test

* Switchable completors: RegexpCompletor and TypeCompletion::Completor

* Add completion info to irb_info

* Complete reserved words

* Fix [*] (*) {**} and prism's change of KeywordParameterNode

* Fix require, frozen_string_literal

* Drop prism<=0.16.0 support

* Add Completor.last_completion_error for debug report

* Retrieve `self` and `Module.nesting` in more safe way

* Support BasicObject

* Handle lvar and ivar get exception correctly

* Skip ivar reference test of non-self object in ruby < 3.2

* BaseScope to RootScope, move method objects constant under Methods

* Remove unused Splat struct

* Drop deeply nested array/hash type calculation from actual object. Now, calculation depth is 1

* Refactor loading rbs in test, change preload_in_thread not to cache Thread object

* Use new option added in prism 0.17.1 to parse code with localvars

* Add Prism version check and warn when :type completor cannot be enabled

* build_type_completor should skip truffleruby (because endless method definition is not supported)

https://github.com/ruby/irb/commit/1048c7ed7a
2023-11-08 02:46:33 +00:00
Sutou Kouhei
7ed37388fb [ruby/stringio] Add missing row separator encoding conversion
(https://github.com/ruby/stringio/pull/69)

The conversion logic is borrowed from ruby/ruby's io.c:
40391faeab/io.c (L4059-L4079)

Fix ruby/stringio#68

Reported by IWAMOTO Kouichi. Thanks!!!

https://github.com/ruby/stringio/commit/4b170c1a68
2023-11-08 00:46:17 +00:00
git
2f07963609 Update default gems list at ce8301084f661f8a22b36bc6f7207b [ci skip] 2023-11-08 00:30:22 +00:00
Sutou Kouhei
ce8301084f [ruby/strscan] Bump version
https://github.com/ruby/strscan/commit/1b3393be05
2023-11-08 09:26:58 +09:00
Sutou Kouhei
9c2e0d49fe [ruby/fiddle] Remove garbage
https://github.com/ruby/fiddle/commit/bbcb66e16e
2023-11-08 09:25:45 +09:00
Sutou Kouhei
c19ea1066a [ruby/fiddle] Include stdbool.h explicitly for old Ruby
https://github.com/ruby/fiddle/commit/74a05fb358
2023-11-08 09:25:45 +09:00