Граф коммитов

86031 Коммитов

Автор SHA1 Сообщение Дата
Jean Boussier c81360db75 Kernel#warn: don't call `Warning.warn` unless the category is enabled
[Bug #20573]

Followup: https://github.com/ruby/ruby/pull/10960

I believe `Kernel#warn` should behave in the same way than internal
`rb_warning_* APIs
2024-06-12 20:57:31 +02:00
Maxime Chevalier-Boisvert ce06924a17
YJIT: add context cache hits stat (#10979)
* YJIT: add context cache hits stat

This stat should make more sense when it comes to interpreting
the effectiveness of the cache on large deployed apps.
2024-06-12 13:33:27 -04:00
Aaron Patterson 85190d4130 Add regression test for Bug #20573
Just a regression test to ensure behavior remains the same
2024-06-12 10:25:57 -07:00
tomoya ishida 783eaf70f8 [ruby/irb] Invalid encoding symbol now raises SyntaxError also in
3.3
(https://github.com/ruby/irb/pull/969)

https://github.com/ruby/irb/commit/bad7492ab0
2024-06-12 16:57:55 +00:00
Matt Valentine-House 96974c6c0d Simplify GC bitmap access macros
Now that we're using the inline predicate functions everywhere, the only
remaining use of the RVALUE_?_BITMAP macros is inside their respective
inline function, so we can remove them.
2024-06-12 17:09:07 +01:00
Matt Valentine-House 5cf5370116 Use RVALUE_UNCOLLECTIBLE consistently 2024-06-12 17:09:07 +01:00
Matt Valentine-House 4c38b4f70f Use RVALUE_WB_UNPROTECTED consistently 2024-06-12 17:09:07 +01:00
Matt Valentine-House cc700c3d8f Use RVALUE_MARKING consistently 2024-06-12 17:09:07 +01:00
Matt Valentine-House e006a58f07 Use RVALUE_MARKED consistently 2024-06-12 17:09:07 +01:00
Matt Valentine-House bb663fe0b2 Use RVALUE_PINNED consistently 2024-06-12 17:09:07 +01:00
git 22ad7d72e1 Update default gems list at 006ff5e29f [ci skip] 2024-06-12 14:24:30 +00:00
Mari Imaizumi 006ff5e29f [ruby/reline] Bump version to 0.5.9
(https://github.com/ruby/reline/pull/724)

https://github.com/ruby/reline/commit/aff1d852bb
2024-06-12 14:23:18 +00:00
Matt Valentine-House 1db19a2dbd Remove unneeded loop through size_pools
This function loops twice through the array of size pools. Once to set
up the pages list, and then again later on in the function to set the
allocatable_pages count.

We don't do anything with the size pools in between the invocation of
these loops that will affect the size pools, so this commit removes the
second loop and moves the allocatable_pages count update into the first
loop.
2024-06-12 13:54:20 +01:00
David Rodríguez 6b6fd16219 [rubygems/rubygems] Fix typo
https://github.com/rubygems/rubygems/commit/19a0e3730c
2024-06-12 12:46:06 +00:00
Nobuyoshi Nakada 32a555ea53
[Bug #20572] Abandon if replacing destination is the same 2024-06-12 19:57:50 +09:00
Yudai Takada 278a7cb057
[DOC] Fix a typo in dir.c
s/Retruns/Returns/
2024-06-12 10:42:01 +00:00
tomoya ishida c56d0adfa6 [ruby/irb] Cleanup irbrc generator cache always at teardown
(https://github.com/ruby/irb/pull/968)

https://github.com/ruby/irb/commit/905184ff9c
2024-06-12 07:48:03 +00:00
ydah 2eb31a6254 Fix a typo
s/sepcifier/specifier/
2024-06-12 15:45:06 +09:00
S-H-GAMELINKS 1fc0763724 Introduce `ident_or_const` inline rule 2024-06-12 15:36:55 +09:00
Nobuyoshi Nakada 01b13886dc [Bug #20562] Categorize `RUBY_FREE_AT_EXIT` warning as experimental 2024-06-12 15:36:10 +09:00
Nobuyoshi Nakada 0bc91fa6df
`File.umask` does not make sense on Windows 2024-06-12 14:46:29 +09:00
Koichi Sasada 39c9d99f6c 'SPEC_TEMP_DIR` should not be world-writable
`SPEC_TEMP_DIR` is not present until `tmp()` method is called
on parallel run. In this case `tmp()` is called with `File.umask = 0`.
This patch makes `SPEC_TEMP_DIR` before `File.umask = 0`.

To solve the issue essentially, I think `SPEC_TEMP_DIR` should be
prepared at the beginning of parallel process.
2024-06-12 14:06:42 +09:00
Nobuyoshi Nakada 206465e84d ripper: Unify `dispatch_end` 2024-06-12 11:49:33 +09:00
Aaron Patterson 1271ff72d5 Don't call `Warning.warn` unless the category is enabled
The warning category should be enabled if we want to call
`Warning.warn`.

This commit speeds up the following benchmark:

```ruby
eval "def test; " +
  1000.times.map { "'  '.chomp!" }.join(";") + "; end"

def run_benchmark count
  i = 0
  while i < count
    start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
    yield
    ms = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
    puts "itr ##{i}: #{(ms * 1000).to_i}ms"
    i += 1
  end
end

run_benchmark(25) do
  250.times do
    test
  end
end
```

On `master` this runs at about 92ms per iteration. With this patch, it
is 7ms per iteration.

[Bug #20573]
2024-06-11 14:54:15 -07:00
Takashi Kokubun 0a6b1a4d9d redmine-backporter.rb: Prepend commit: to shorter revs
Some of the places in Redmine (e.g. Associated revisions) print
revisions using only 8 characters. Even when I copied a revision from
there, I want to prepend commit: in the message.
2024-06-11 11:28:04 -07:00
Takashi Kokubun ec1ea2c5b9 YJIT: Make num_contexts_encoded a default counter 2024-06-11 10:17:41 -07:00
gartens c735f4947e [ruby/openssl] Pass through nil as digest when signing certificates
(https://github.com/ruby/openssl/pull/761)

In order to sign certificates with Ed25519 keys, NULL must be passed
as md to X509_sign.  This NULL is then passed
(via ASN1_item_sign_ex) as type to EVP_DigestSignInit.  The
documentation[1] of EVP_DigestSignInit states that type must be NULL
for various key types, including Ed25519.

[1]: https://www.openssl.org/docs/manmaster/man3/EVP_DigestSignInit.html

https://github.com/ruby/openssl/commit/b0fc100091
2024-06-11 17:12:28 +00:00
Maxime Chevalier-Boisvert 39019b6a63
YJIT: add context cache size stat, lazily allocate cache
* YJIT: add context cache size stat
* Allocate the context cache in a box so CRuby doesn't pay overhead
* Add an extra debug assertion
2024-06-11 12:46:11 -04:00
David Rodríguez 568132af16 [rubygems/rubygems] Keep credentials in lockfile if they are already there
So that those lockfiles still work with older Bundler versions.

https://github.com/rubygems/rubygems/commit/880275bb66
2024-06-11 16:27:44 +00:00
Peter Zhu 32683aa18d Remove use of symbols and arrays when freeing global table
This removes the use of symbol and array objects when freeing the global
table so we can now free symbols and arrays earlier.
2024-06-11 10:33:51 -04:00
Kevin Newton 89ebe8993f Ensure prism is testing everything 2024-06-11 09:43:41 -04:00
Kevin Newton 9e7ccc00bc [PRISM] Make prism pass bundler specs 2024-06-11 09:43:41 -04:00
David Rodríguez 3e84da0970 [rubygems/rubygems] Auto switch to locked bundler version even when using binstubs
https://github.com/rubygems/rubygems/commit/076aba8b1c
2024-06-11 13:30:50 +00:00
Matt Valentine-House ad9fe6f376 Allow gdb to search source path for required files
When doing out-of-source builds I often end up wanting to use gdb from
inside a build directory.

Currently if I do that the `.gdbinit` in the ruby source directory is
not read.

Attempting to manually load the `.gdbinit` from the Ruby source
directory errors because of hard coded file-paths that assume we're
running gdb from inside the source tree.

Adding the `-s` flag to the `source` command when loading relative files
signals to gdb to search in the source search path for the required
file, rather than just the current directory.

This allows me to use a custom `.gdbinit` from my build directory that
sets the correct source directory and then loads the Ruby `.gdbinit`.

```
dir ../src
source ../src/.gdbinit
```
2024-06-11 14:03:58 +01:00
Kevin Newton 47322b592a [ruby/prism] Match CRuby error message for unknown regexp options
https://github.com/ruby/prism/commit/73669b59f6
2024-06-11 12:34:00 +00:00
Kevin Newton d6b1822f22 [ruby/prism] Fix binding power for class <<
https://github.com/ruby/prism/commit/cd66c478de
2024-06-11 12:33:46 +00:00
Jun Aruga b824b13ee9 .travis.yml: Update jaruga's email.
I cannot receive Travis's notification via jaruga@ruby-lang.org, while another
committer with their @ruby-lang.org email can receive the notification.
The issue is my ruby-lang.org email address specific.
So far we haven't seen the root cause even with the Travis support's help.

Because of that, I change the email address to my personal email address.
2024-06-11 13:56:32 +02:00
KJ Tsanaktsidis 0ccb80d6bf Extract hardening CFLAGS to a special $hardenflags variable
This changes the automatic detection of -fstack-protector,
-D_FORTIFY_SOURCE, and -mbranch-protection to write to $hardenflags
instead of $XCFLAGS. The definition of $cflags is changed to
"$hardenflags $orig_cflags $optflags $debugflags $warnflags" to match.

Furthermore, these flags are _prepended_ to $hardenflags, rather than
appended.

The implications of doing this are as follows:

* If a CRuby builder specifies cflags="-mbranch-protection=foobar" at
  the ./configure script, and the configure script detects that
  -mbranch-protection=pac-ret is accepted, then GCC will be invoked as
  "gcc -mbranch-protection=pac-ret -mbranch-protection=foobar". Since
  the last flags take precedence, that means that user-supplied values
  of these flags in $cflags will take priority.
* Likewise, if a CRuby builder explicitly specifies
  "hardenflags=-mbranch-protection=foobar", because we _prepend_ to
  $hardenflags in our autoconf script, we will still invoke GCC as
  "gcc -mbranch-protection=pac-ret -mbranch-protection=foobar".
* If a CRuby builder specifies CFLAGS="..." at the configure line,
  automatic detection of hardening flags is ignored as before.
* C extensions will _also_ be built with hardening flags now as well
  (this was not the case by default before because the detected flags
  went into $XCFLAGS).

Additionally, as part of this work, I changed how the detection of
PAC/BTI in Context.S works. Rather than appending the autodetected
option to ASFLAGS, we simply compile a set of test programs with the
actual CFLAGS in use to determine what PAC/BTI settings were actually
chosen by the builder. Context.S is made aware of these choices through
some custom macros.

The result of this work is that:

* Ruby will continue to choose some sensible defaults for hardening
  options for the C compiler
* Distributors are able to specify CFLAGS that are consistent with their
  distribution and override these defaults
* Context.S will react to whatever -mbranch-protection is actually in
  use, not what was autodetected
* Extensions get built with hardening flags too.

[Bug #20154]
[Bug #20520]
2024-06-11 20:48:55 +10:00
Koichi Sasada 6086bae5c8 check `SPEC_TEMP_DIR` is world-writable or not
```
1)
Dir.mktmpdir when passed a block yields the path to the passed block ERROR
ArgumentError: parent directory is world writable but not sticky: /tmp/rubytest.wlu5cs_11
/tmp/ruby/src/trunk/lib/tmpdir.rb:113:in 'Dir.mktmpdir'
/tmp/ruby/src/trunk/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb:39:in 'block (2 levels) in <top (required)>'
```

This weird error comes from world-writable (and not sticky) directory
of `SPEC_TEMP_DIR`.

This patch checks `SPEC_TEMP_DIR` is not world-writable if exists
and `File.umask` contains o+w mask.
2024-06-11 17:02:27 +09:00
Jean Boussier f0001a4fa7 compile.c: use putspecialobject for RubyVM::FrozenCore
[Bug #20569]

`putobject RubyVM::FrozenCore`, is not serializable, we
have to use `putspecialobject VM_SPECIAL_OBJECT_VMCORE`.
2024-06-11 09:08:48 +02:00
Kevin Newton d827d32527 [ruby/prism] Provide ability to lock encoding while parsing
https://github.com/ruby/prism/commit/f7faedfb3f
2024-06-10 17:21:32 -04:00
Kevin Newton 0d5eea9957 [ruby/prism] Disallow multi writes when not in statement level
https://github.com/ruby/prism/commit/fe34a77df2
2024-06-10 17:21:32 -04:00
Peter Zhu 556bbf64e0 Don't skip test_inspect_under_gc_compact_stress
Commit 1471a16 seems to have fixed this flaky test, so we don't need to
skip it for YJIT or RJIT anymore.
2024-06-10 12:36:25 -04:00
tomoya ishida 1d0d8a89d4 [ruby/reline] Add more fallbacks when terminfo is not available
(https://github.com/ruby/reline/pull/722)

Add xterm key bindings to comprehensive list
Add fallback escape sequence of cursor hide/show

https://github.com/ruby/reline/commit/e3c73bbe26
2024-06-10 15:31:33 +00:00
Andrew Konchin 3cc9a12679 Fix CI when YJIT is enabled 2024-06-10 16:00:37 +02:00
Andrew Konchin 3ebab4b64d Update to ruby/spec@517f06f 2024-06-10 16:00:37 +02:00
tomoya ishida e8bd745c17 [ruby/reline] Suppress warning(Ruby 3.4) requiring fiddle from
terminfo.rb
(https://github.com/ruby/reline/pull/721)

https://github.com/ruby/reline/commit/9da2cbcd82
2024-06-10 13:57:28 +00:00
Kevin Newton 21e06e57af [ruby/prism] Allow block exits in loop predicates
https://github.com/ruby/prism/commit/f09db18e46
2024-06-10 13:42:40 +00:00
Koichi Sasada 528a23b53c Check current file on TracePoint
```
1)
TracePoint#inspect returns a String showing the event, method, path and line for a :call event FAILED
Expected "#<TracePoint:call 'call' /tmp/ruby/src/trunk/spec/ruby/core/objectspace/define_finalizer_spec.rb:33>" =~ /\A#<TracePoint:call [`']trace_point_spec_test_call' \/tmp\/ruby\/src\/trunk\/spec\/ruby\/core\/tracepoint\/inspect_spec.rb:43>\z/
to be truthy but was nil
```

This kind of failures comes because of finaizers.
So check the current file or not.
2024-06-10 12:23:39 +02:00
Nobuyoshi Nakada 8abdd56c31
Test `rb_ext_resolve_symbol` without Windows .def files
`RUBY_FUNC_EXPORTED` is working on Windows since 906a86e4de.
And as .def files are not processed by the preprocessor, it is less
flexible than `RUBY_FUNC_EXPORTED`, (e.g., select symbols by
conditions such as ruby version).
2024-06-10 17:47:35 +09:00