As pointed out in the
[comment](https://github.com/ruby/reline/pull/413#issuecomment-1168033973),
the code is actually a control sequence and not only for colors.
To make the dialog color APIs safer to use, we should restrict its
usages and extract away the bg/fg concept from the input.
So in this commit, I made these changes:
1. The dialog_*_bg/fg_color APIs only takes and returns color names (symbol):
- :black
- :red
- :green
- :yellow
- :blue
- :magenta
- :cyan
- :white
2. Add additional dialog_*_bg/fg_color_sequence APIs to access the raw code.
https://github.com/ruby/reline/commit/b32a977766
This commit implements Objects on Variable Width Allocation. This allows
Objects with more ivars to be embedded (i.e. contents directly follow the
object header) which improves performance through better cache locality.
Since #6006, we no longer avoid executing GC on mjit_worker.c and thus
there's no need to carefully change how we write code whether you're in
mjit.c or mjit_worker.c anymore.
When retrying in ruby's test, it seems possible that `Gem` is not
loaded.
```
1) Error:
TC_Set_Builtin#test_to_set:
NameError: uninitialized constant TC_Set_Builtin::Gem
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:844:in `should_omit?'
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:869:in `test_to_set'
2) Error:
TC_Set_Builtin#test_Set:
NameError: uninitialized constant TC_Set_Builtin::Gem
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:844:in `should_omit?'
/export/home/chkbuild/chkbuild-gcc/tmp/build/20220708T070011Z/ruby/test/test_set.rb:849:in
`test_Set'
```
This is by `Gem::Version` only, just compare as array of integers
instead.
https://github.com/ruby/set/commit/cde0a4bbc7
We saw the following failure:
```
TestThreadInstrumentation#test_thread_instrumentation [/tmp/ruby/v3/src/trunk-random3/test/-ext-/thread/test_instrumentation_api.rb:25]:
Expected 0..3 to include 4.
```
Which shouldn't happen unless somehow there was a leaked thread.
This commit enables Arrays to move between size pools during compaction.
This can occur if the array is mutated such that it would fit in a
different size pool when embedded.
The move is carried out in two stages:
1. The RVALUE is moved to a destination heap during object movement
phase of compaction
2. The array data is re-embedded and the original buffer free'd if
required. This happens during the update references step
At that commit, I fixed a wrong conditional expression that was always
true. However, that seemed to have caused a regression. [Bug #18906]
This change removes the condition to make the code always enabled.
It had been enabled until that commit, albeit unintentionally, and even
if it is enabled it only consumes a tiny bit of memory, so I believe it
is harmless. [Bug #18906]
RFC 6066 states how some wildcard SAN entries MAY be handled, but
it does not say they MUST be handled. LibreSSL 3.5.0 only handles
suffix wildcard SANs, not prefix wildcard SANs, or interior
wildcard SANs, so return early from the wildcard SAN tests on
LibreSSL 3.5.0.
Fixes#471https://github.com/ruby/openssl/commit/717d7009d6
```
test/ruby/test_parse.rb:1384: warning: assigned but unused variable - obj
test/ruby/test_pattern_matching.rb:1162: warning: unused literal ignored
test/ruby/test_pattern_matching.rb:1165: warning: unused literal ignored
test/ruby/test_pattern_matching.rb:1161: warning: assigned but unused variable - a
test/ruby/test_pattern_matching.rb:1164: warning: assigned but unused variable - b
```
And a newline should be significant here.
Recently `TestThreadInstrumentation#test_join_counters` often fails as
```
<[1, 1, 1]> expected but was
<[2, 2, 2]>.
```
Probably it seems that the thread is suspended more than once.
There may be no guarantee that the subject thread never be suspended
more than once.
[Bug #18900]
Thread#join and a few other codepaths are using native sleep as
a way to suspend the current thread. So we should call the relevant
hook when this happen, otherwise some thread may transition
directly from `RESUMED` to `READY`.
Modifies RDoc to Emphasize keys instead of roots, values instead of objects.
Code:
Renames method #root? to #key? and method #roots to #keys.
Aliases method #key as #root and method #keys as #roots.
Adds testing for all four methods.
https://github.com/ruby/pstore/commit/4436ea0891
I suspect that some shared pages are invalidated because
some static string don't have their coderange set eagerly.
So the first time they are scanned, the entire memory page is
invalidated.
Being able to see the coderange in `ObjectSpace` would help debug
this.
And in addition `dump` currently call `is_broken_string()` and `is_ascii_string()`
which both end up scanning the string and assigning coderange. I think it's
undesirable as `dump` should be read only.
Some context tests assigns USE_COLORIZE to false and never change it
back. This can potentially affect other tests' result as the default
should be nil (activated) instead.
https://github.com/ruby/irb/commit/986eb16ece
Under POSIX behavior of leading // is implementation defined. Musl does
preserve it in realpath, glibc does not. That means the test was failing
when executed on alpine linux. Original issue #508 was about // in the
path, not about leading ones. When executed in such environment, the
test will still test what it should when the explicit mangling of the
path is not done.
Fixes#5652https://github.com/rubygems/rubygems/commit/0fa7373bf6
* Use colorable: argument as the only coloring control
* Centalize color controling logic at Color.colorable?
There are 2 requirements for coloring output:
1. It's supported on the platform
2. The user wants it: `IRB.conf[:USE_COLORIZE] == true`
Right now we check 1 and 2 separately whenever we colorize things.
But it's error-prone because while 1 is the default of `colorable`
parameter, 2 always need to manually checked. When 2 is overlooked, it
causes issues like https://github.com/ruby/irb/pull/362
And there's 0 case where we may want to colorize even when the user
disables it. So I think we should merge 2 into `Color.colorable?` so it
can be automatically picked up.
* Add tests for all inspect modes
* Simplify inspectors' coloring logic
* Replace use_colorize? with Color.colorable?
* Remove Context#use_colorize cause it's redundant
https://github.com/ruby/irb/commit/1c53023ac4
New test failures on MINGW appeared after
c2e37c8ff7.
1) Error:
Rinda::TupleSpaceProxyTest#test_00_template:
NoMethodError: undefined method `stop_service' for nil:NilClass
D:/a/ruby/ruby/src/test/rinda/test_rinda.rb:516:in `teardown'
2) Error:
Rinda::TupleSpaceProxyTest#test_ruby_talk_264062:
NoMethodError: undefined method `stop_service' for nil:NilClass
D:/a/ruby/ruby/src/test/rinda/test_rinda.rb:516:in `teardown'
Teardown happens even when the test is omitted.
See: https://github.com/ruby/ruby/runs/7058984522
As you all know, MinGW UCRT64 CI has randomly got stuck despite its
"Finished tests" output.
Looking at the logs closely, it seems like all of the recent such
reproductions end with the following output:
```
Retrying hung up testcases...
[ 1/14] Rinda::TupleSpaceProxyTest#test_ruby_talk_264062 = 0.21 s
[ 2/14] Rinda::TupleSpaceProxyTest#test_00_template = 0.01 s
[ 3/14] Rinda::TupleSpaceProxyTest#test_inp_rdp = 0.00 s
[ 4/14] Rinda::TupleSpaceProxyTest#test_core_03_notify = 0.01 s
[ 5/14] Rinda::TupleSpaceProxyTest#test_00_renewer = 0.01 s
[ 6/14] Rinda::TupleSpaceProxyTest#test_cancel_02 = 0.11 s
[ 7/14] Rinda::TupleSpaceProxyTest#test_00_DRbObject = 0.00 s
[ 8/14] Rinda::TupleSpaceProxyTest#test_core_02 = 0.11 s
[ 9/14] Rinda::TupleSpaceProxyTest#test_core_01 = 0.11 s
[10/14] Rinda::TupleSpaceProxyTest#test_remote_array_and_hash = 0.01 s
[11/14] Rinda::TupleSpaceProxyTest#test_00_tuple = 0.00 s
[12/14] Rinda::TupleSpaceProxyTest#test_take_bug_8215 = 0.41 s
[13/14] Rinda::TupleSpaceProxyTest#test_cancel_01 = 0.11 s
[14/14] Rinda::TupleSpaceProxyTest#test_symbol_tuple = 0.01 s
Finished tests in 719.252845s, 29.4292 tests/s, 3838.7154 assertions/s.
21167 tests, 2761007 assertions, 0 failures, 0 errors, 708 skips
```
https://github.com/ruby/ruby/runs/7057789554
While it seems to be retried successfully, given that it hungs up once
and this appears all the time, this test class seems a bit suspicious.
To check if it's related, let me try disabling this for now.
When outputting a (possibly truncated) value, IRB will query the
window size. However, if IRB was piped to another process, stdout
will no longer be a TTY and will not support the `winsize` method.
This fix ensure that stdout is a TTY.
https://github.com/ruby/irb/commit/125de5eeea
While generate_index did clean up temporary directory, when running with
--update flag, that did not happen and the temporary directory was left
behind.
This commit fixes that and modifies tests in order to make sure this is
not reintroduced later on.
Fixes#5635.
https://github.com/rubygems/rubygems/commit/9fa34dc329
Previously, we didn't pop the frame that runs the TracePoint hook for
b_return events for blocks running as methods (bmethods). In case the
hook raises, that formed an infinite loop during stack unwinding in
hook_before_rewind().
[Bug #18060]
Since enabling YJIT or MJIT drastically changes what could go wrong at
runtime, it's good to be front and center about whether they are enabled
when dumping a crash report. Previously, `RUBY_DESCRIPTION` and the
description printed when crashing can be different when a JIT is on.
Introduce a new internal data global, `rb_dynamic_description`, and set
it to be the same as `RUBY_DESCRIPTION` during initialization; use it
when crashing.
* version.c: Init_ruby_description(): Initialize and use
`rb_dynamic_description`.
* error.c: Change crash reports to use `rb_dynamic_description`.
* ruby.c: Call `Init_ruby_description()` earlier. Slightly more work
for when we exit right after printing the description but that
was deemed acceptable.
* include/ruby/version.h: Talk about how JIT info is not in
`ruby_description`.
* test/-ext-/bug_reporter/test_bug_reporter.rb: Remove handling for
crash description being different from `RUBY_DESCRIPTION`.
* test/ruby/test_rubyoptions.rb: ditto
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
I suspect that sometimes on CI the last thread is prempted before eaching the exit hook
causing the test to flake. I can't find a good way to force it to run.
It previously failed with:
```
1) Failure:
TestThreadInstrumentation#test_thread_instrumentation_fork_safe [/home/runner/work/ruby/ruby/src/test/-ext-/thread/test_instrumentation_api.rb:50]:
<5> expected but was
<4>.
```
Suggesting one `EXIT` event wasn't fired or processed.
Adding an assetion on `Thead#status` may help figure out what is wrong.
[Feature #18339]
After experimenting with the initial version of the API I figured there is a need
for an exit event to cleanup instrumentation data. e.g. if you record data in a
{thread_id -> data} table, you need to free associated data when a thread goes away.
Previously protected methods on refinements could never be called
because they were seen as being "defined" on the hidden refinement
ICLASS.
This commit updates calling refined protected methods so that they are
considered to be defined on the original class (the one being refined).
This ended up using the same behaviour that was used to check whether a
call to super was allowed, so I extracted that into a method.
[Bug #18806]
* Added a nil check in Net::HTTPHeader#initialize_http_header for keys in the header that do not have any value
* Returning nil from the content_range method instead of raising an error when the unit in the content-range header is not bytes
* Modified initialize_http_header to match trunk
fix [Bug #11450]
fix https://github.com/ruby/ruby/pull/1018
Previously, because opt_aref and opt_aset don't push a frame, when they
would call rb_hash to determine the hash value of the key, the initial
level of recursion would incorrectly use the method id at the top of the
stack instead of "hash".
This commit replaces rb_exec_recursive_outer with
rb_exec_recursive_outer_mid, which takes an explicit method id, so that
we can make the hash calculation behave consistently.
rb_exec_recursive_outer was documented as being internal, so I believe
this should be okay to change.
df317151a5 removed the code to free
rb_hook_list_t, so repeated targeting of the same bmethod started
to leak the hook list. You can observe how the maximum memory use
scales with input size in the following script with `/usr/bin/time -v`.
```ruby
o = Object.new
o.define_singleton_method(:foo) {}
trace = TracePoint.new(:return) {}
bmethod = o.method(:foo)
ARGV.first.to_i.times { trace.enable(target:bmethod){} }
4.times {GC.start}
```
After this change the maximum doesn't grow as quickly.
To plug the leak, check whether the hook list is already allocated
when enabling the targeting TracePoint for the bmethod. This fix
also allows multiple TracePoints to target the same bmethod, similar
to other valid TracePoint targets.
Finally, free the rb_hook_list_t struct when freeing the method
definition it lives on. Freeing in the GC is a good way to avoid
lifetime problems similar to the one fixed in df31715.
[Bug #18031]