76448 Commits

Author SHA1 Message Date
Koichi Sasada
0d415a322f Enable DEBUG_LOG feature on USE_RUBY_DEBUG_LOG
`ruby_set_debug_option` is needed for `RUBY_DEBUG_LOG` feature
so it should be called when `USE_RUBY_DEBUG_LOG` is true.
2023-03-01 17:18:43 +09:00
Jean Boussier
40e5ee64f0 Implement Write Barrier for autoload_table_type
It's just a decorated st_table, so we call `RB_OBJ_WRITTEN` after
inserting to it.

We also call `RB_OBJ_WRITTEN` on delete for completeness even though
it's a noop.
2023-03-01 08:56:56 +01:00
git
ee83274f36 Update bundled gems list at 2023-03-01 2023-03-01 07:02:27 +00:00
Lars Kanis
47f8bf50e1 [DOC] Clarify IO#autoclose impact on #close
Mention that autoclose changes the behavior of explicit close in addition to implicit close at IO finalization.
2023-03-01 16:02:11 +09:00
Daniel Colson
62b3bcba5e [rubygems/rubygems] Auto-heal on corrupted lockfile with missing deps
Following up on https://github.com/rubygems/rubygems/pull/6355, which
turned a crash into a nicer error message, this commit auto-heals the
corrupt lockfile instead.

In this particular case (a corrupt Gemfile.lock with missing
dependencies) the LazySpecification will not have accurate dependency
information, we have to materialize the SpecSet to determine there are
missing dependencies. We've already got a way to handle this, via
`SpecSet#incomplete_specs`, but it wasn't quite working for this case
because we'd get to `@incomplete_specs += lookup[name]` and
`lookup[name]` would be empty for the dependency.

With this commit we catch it a bit earlier, marking the parent spec
containing the missing dependency as incomplete.

https://github.com/rubygems/rubygems/commit/486ecb8f20
2023-03-01 02:50:40 +00:00
John Bampton
c43fbe4ebd
Fix spelling (#7405) 2023-02-28 10:05:30 -08:00
Takashi Kokubun
966adfb799
YJIT: Compress BranchGenFn and BranchShape (#7401)
* YJIT: Compress BranchGenFn and BranchShape

* YJIT: Derive Debug for Branch

* YJIT: Capitalize BranchGenFn names

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2023-02-28 10:04:28 -08:00
Takashi Kokubun
67ad831b5f
YJIT: Use a boxed slice for gc_obj_offsets (#7397)
* YJIT: Use a boxed slice for gc_obj_offsets

* YJIT: Stop using Option

* YJIT: s/add_counter/incr_counter_by/

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2023-02-28 10:03:24 -08:00
Matt Valentine-House
3766cbce13 Update Rust bindgen 2023-02-28 09:09:00 -08:00
Matt Valentine-House
5e4b80177e Update the depend files 2023-02-28 09:09:00 -08:00
Matt Valentine-House
460f399c5a Merge internal/rgengc.h and internal/gc.h 2023-02-28 09:09:00 -08:00
Maxime Chevalier-Boisvert
de66b60f33 YJIT: add defer_empty_count stat
Count how often we defer from a block that is empty
2023-02-28 11:57:41 -05:00
Stan Lo
9ddd73060b [ruby/irb] Display and prioritise instance methods in `ls
<module/class>`
(https://github.com/ruby/irb/pull/496)

https://github.com/ruby/irb/commit/e3d21f9329
2023-02-28 14:36:12 +00:00
Samuel Giddins
2d6097a0f5 [rubygems/rubygems] Fix method redefinition warning in gem exec specs
https://github.com/rubygems/rubygems/commit/f177990d4c
2023-02-28 12:54:37 +00:00
Jean Boussier
cf18f0b868 Implement Write Barrier for autoload_data
It's not uncommon for libraries to add thing sinto
autoload that won't necessarily be loaded.

This can cause hundreds or thousands of entries to be
left over in the autoload table, so it's best not to
mark them on every minor.
2023-02-28 09:27:55 +01:00
git
cd1991281e Update bundled gems list at 2023-02-28 2023-02-28 07:01:59 +00:00
Hiroshi SHIBATA
9cc0ac22f7
Update lib/net/http/status.rb 2023-02-28 14:29:57 +09:00
Hiroshi SHIBATA
66b89b069d
Also ignore dismissed CodeQL alerts at tests and URI library 2023-02-28 12:44:13 +09:00
dependabot[bot]
c3e57d686a Bump ruby/setup-ruby from 1.138.0 to 1.139.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.138.0 to 1.139.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Commits](d3c9825d67...92aece5fc9)

---
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-02-28 12:35:10 +09:00
Jean Boussier
71dae78b89 [ruby/stringio] Implement write barrier on StringIO
It only has a single reference set in 3 places which
makes it fairly easy to implement.

https://github.com/ruby/stringio/commit/009896b973
2023-02-28 03:07:10 +00:00
Hiroshi SHIBATA
ad679ec9e5 Ignore rb/overly-large-range on URI 2023-02-28 12:05:57 +09:00
Hiroshi SHIBATA
c21260e3ff Enable only master branch for CodeQL push trigger 2023-02-28 12:05:57 +09:00
Hiroshi SHIBATA
9ff09d695c Run CodeQL each PRs again 2023-02-28 12:05:57 +09:00
Hiroshi SHIBATA
7a9fb3262c Do not upload sarif file as artifact 2023-02-28 11:48:19 +09:00
Hiroshi SHIBATA
fbbe285019 Do not OSS scorecards check each push 2023-02-28 11:48:19 +09:00
lukeg
d2c38aa823 A file was missing in test/excludes for TestArraySubclass 2023-02-28 11:04:32 +09:00
Sébastien Helleu
97b53d1a4a Remove "unused parameter" warnings on include of ruby.h
These warnings are displayed when compiling with flag "-Wunused-parameter" (or
with "-Wall -Wextra").
2023-02-28 10:27:37 +09:00
lukeg
ba55706fb6 fix test/rubygems/test_gem_package_task.rb when in -j mode
This test skipped sometimes due to failure to load 'rake/packagetask'.
This is due to manipulation of $LOAD_PATH by other rubygems tests. If
rake is loaded before any rubygems tests run, then it works fine.

To reproduce the skipping behavior:
  $ make test-all TESTOPTS="-j6 --test-order=sorted test/rubygems/test_*.rb"
2023-02-28 06:34:27 +09:00
Takashi Kokubun
283c71eeff Skip a spec failing on master
https://github.com/ruby/ruby/actions/runs/4286361460/jobs/7466545010
http://ci.rvm.jp/results/trunk_gcc9@ruby-sp2-docker/4462424
http://ci.rvm.jp/results/trunk_clang_13@ruby-sp2-docker/4462422
2023-02-27 12:53:04 -08:00
Benoit Daloze
18b4def471 Update to ruby/spec@e7dc804 2023-02-27 21:02:44 +01:00
Benoit Daloze
de60139053 Update to ruby/mspec@dc2eb26 2023-02-27 21:02:42 +01:00
Matt Valentine-House
f38c6552f9 Remove intern/gc.h from Make deps 2023-02-27 10:11:56 -08:00
Matt Valentine-House
98e4bdf3e7 Update YJIT-bindgen 2023-02-27 10:11:56 -08:00
Matt Valentine-House
ae5e62ee90 Merge internal/intern/gc.h into internal/gc.h 2023-02-27 10:11:56 -08:00
John Bampton
2f7270c681
Fix spelling (#7389) 2023-02-27 09:56:06 -08:00
Takashi Kokubun
526111290b Revert "reuse open(2) from rb_file_load_ok on POSIX-like system"
This reverts commit 35136e1e9c232ad7a03407b992b2e86b6df43f63.

test-spec has been failing since this revision.

.github/workflows/compilers.yml:82
https://github.com/ruby/ruby/actions/runs/4276884159/jobs/7445299562

```
env:
  # Minimal flags to pass the check.
  default_cc: 'gcc-11 -fcf-protection -Wa,--generate-missing-build-notes=yes'
  optflags: '-O2'
  LDFLAGS: '-Wl,-z,now'
  # FIXME: Drop skipping options
  # https://bugs.ruby-lang.org/issues/18061
  # https://sourceware.org/annobin/annobin.html/Test-pie.html
  TEST_ANNOCHECK_OPTS: "--skip-pie --skip-gaps"
```

Failure:

```
  1)
  An exception occurred during: Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317
  Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR
  LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>'

  2)
  An exception occurred during: Kernel#require ($LOADED_FEATURES) stores an absolute path
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330
  Kernel#require ($LOADED_FEATURES) stores an absolute path ERROR
  LeakError: Closed file descriptor: 8
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>'

  3)
  An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535
  Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR
  LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>'

  4)
  An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551
  Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR
  LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>'

  5)
  An exception occurred during: Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563
  Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR
  LeakError: Closed file descriptor: 8
  Closed file descriptor: 9
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>'

  6)
  An exception occurred during: Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317
  Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR
  LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>'

  7)
  An exception occurred during: Kernel.require ($LOADED_FEATURES) stores an absolute path
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330
  Kernel.require ($LOADED_FEATURES) stores an absolute path ERROR
  LeakError: Closed file descriptor: 8
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>'

  8)
  An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535
  Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR
  LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>'

  9)
  An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551
  Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR
  LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>'

  10)
  An exception occurred during: Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required
  /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563
  Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR
  LeakError: Closed file descriptor: 8
  Closed file descriptor: 9
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>'

  11)
  An exception occurred during: Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:197
  Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR
  LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>'

  12)
  An exception occurred during: Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:205
  Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path ERROR
  LeakError: Closed file descriptor: 8
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>'

  13)
  An exception occurred during: Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:399
  Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR
  LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb>
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>'

  14)
  An exception occurred during: Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:407
  Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path ERROR
  LeakError: Closed file descriptor: 8
  /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>'
```
2023-02-27 09:24:45 -08:00
Alan Wu
0eb634ae73 YJIT: Detect and reject send(:alias_for_send, :foo)
Previously, YJIT failed to put the stack into the correct shape when
`BasicObject#send` calls an alias method for the send method itself.
This can manifest as strange `NoMethodError`s in the final non-send
receiver, as [seen][1] with the kt-paperclip gem. I also found a case
where it makes YJIT fail the stack size assertion while compiling
`leave`.

YJIT's `BasicObject#__send__` implementation already rejects sends to
`send`, but didn't detect sends to aliases of `send`. Adjust the
detection and reject these cases.

Fixes [Bug #19464]

[1]: https://github.com/Shopify/yjit/issues/306
2023-02-27 11:12:22 -05:00
Alan Wu
55a24f9b08 YJIT: Reject __send__ with splat to cfunc for now
`make test-spec` revealed this issue after applying an unrelated bug
fix. A crashing case is included, though I suspect there are other
scenarios where it misbehaves. Don't compile for now.

Note that this is *not* an issue on the 3.2.x series; it has
`send_args_splat_non_iseq` which already rejects all splats to cfuncs,
including sends with splats.
2023-02-27 11:12:22 -05:00
Stan Lo
ea830ab29d [ruby/irb] Add a comment about Rails' patch on
Workspace#filter_backtrace
(https://github.com/ruby/irb/pull/526)

* Add a comment about Rails' patch on Workspace#filter_backtrace

* Update lib/irb/workspace.rb

Co-authored-by: Sorah Fukumori <sora134@gmail.com>

---------

https://github.com/ruby/irb/commit/9443d911fc

Co-authored-by: Sorah Fukumori <sora134@gmail.com>
2023-02-27 15:23:31 +00:00
Stan Lo
0aa50a03b1 [ruby/irb] Provide more useful message when
`IRB::Inspector#inspect_value` errors
(https://github.com/ruby/irb/pull/511)

**Before**

```
irb(main):001:0> c = Cat.new "foo"
(Object doesn't support #inspect)
=>
```

**After**

```
irb(main):001:0> c = Cat.new "foo"
An error occurred when inspecting the object: #<NoMethodError: undefined method `is_a?' for foo:Cat

      if obj.is_a?(String)
            ^^^^^^>
Result of Kernel#inspect: #<Cat:0x0000000109090d80 @name="foo">
=>
```
2023-02-27 11:07:19 +00:00
tomoya ishida
4f611df3f7 [ruby/reline] Fix wrong indent number in prompt. whole_lines has
duplicated line.
(https://github.com/ruby/reline/pull/460)

* whole_lines should consider prev_line_index, and must not duplicate last_line

* Add test for lines passed to dynamic prompt proc

* Refactor whole_lines parameters used in test helper

* Remove whole_line's arguments
2023-02-27 10:21:30 +00:00
StepSecurity Bot
2cbe1f3ebc [StepSecurity] ci: Harden GitHub Actions
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
2023-02-27 19:09:36 +09:00
Hiroshi SHIBATA
10a80d9dc4 Ignore test case for Kernel and IO methods 2023-02-27 18:49:18 +09:00
Hiroshi SHIBATA
db0a4c8923 Prefer to use File.foreach instead of IO.foreach 2023-02-27 18:49:18 +09:00
Hiroshi SHIBATA
d063ed12af Prefer to use File.binwrite instead of IO.binwrite 2023-02-27 18:49:18 +09:00
Hiroshi SHIBATA
6dfdc7b28e Prefer to use File.binread instead of IO.binread 2023-02-27 18:49:18 +09:00
Hiroshi SHIBATA
d3d8cd304f Prefer to use File.readlines instead of IO.readlines 2023-02-27 18:49:18 +09:00
Hiroshi SHIBATA
ae4d8e99f1 Rename job and workflow names 2023-02-27 17:57:58 +09:00
Hiroshi SHIBATA
f21f51915e Use matrix strategies each language 2023-02-27 17:57:58 +09:00
Hiroshi SHIBATA
b5a1c57c98 Merge codeql-config into codeql-analysis 2023-02-27 17:57:58 +09:00