Issue #19582 has been reported by renodr (Douglas R. Reno).
----------------------------------------
Bug #19582: Segmentation fault when running the tests for Ruby 3.2.2
https://bugs.ruby-lang.org/issues/19582
* Author: renodr (Douglas R. Reno)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
When adding a package update to BLFS, our policy is to run the tests for the packages. When running the tests for Ruby-3.2.2, we're getting a segmentation fault that appears to happen in TestNumeric#test_step. I've attached a copy of Ruby's crash output. Note that Ruby reports itself as "Ruby 3.2.1" here for some reason, even if /usr/bin/ruby is moved out of the way. I'm assuming that this is because of the 'miniruby' program that the build system compiles.
Note that if we bypass this segmentation fault by removing the test from test/ruby/test_numeric.rb, we later get an error that reads:
/sources/ruby-3.2.2/ruby-3.2.2/tool/lib/leakchecker.rb:238:in `block in check_env': uninitialized constant Bundler::EnvironmentPreserver (NameError)
next if k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX)
(Looking at Github, that would be added by commit 6d835901575d58e7db404665801a1c455ee982a8)
For package versions, we're running gcc-12.2.0, glibc-2.37, and Binutils-2.40. I noticed that it looked for rust when checking the configure output - we're running rustc-1.68.2. The base system is Linux From Scratch 11.3.
Some important information from the output:
[BUG] Segmentation fault at 0x0000000000000003
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0004 p:---- s:0012 e:000011 CFUNC :step
c:0003 p:---- s:0009 e:000008 CFUNC :each
c:0002 p:---- s:0006 e:000005 IFUNC
c:0001 p:---- s:0003 e:000002 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
./test/runner.rb: TestNumeric#test_step:0:in `each'
./test/runner.rb: TestNumeric#test_step:0:in `step'
Thank you for your patience!
---Files--------------------------------
ruby-tests.log (454 KB)
--
https://bugs.ruby-lang.org/
Issue #19575 has been reported by peterzhu2118 (Peter Zhu).
----------------------------------------
Bug #19575: Crash in Time on 32-bit systems
https://bugs.ruby-lang.org/issues/19575
* Author: peterzhu2118 (Peter Zhu)
* Status: Open
* Priority: Normal
* Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
----------------------------------------
GitHub PR: https://github.com/ruby/ruby/pull/7650
struct vtm is packed causing it to have a size that is not aligned on 32-bit systems. When allocating it on the stack, it will have unaligned addresses which means that the fields won't be marked by the GC when scanning the stack (since the GC only marks aligned addresses). This can cause crashes when the fields are heap allocated objects like Bignums.
The proposed fix moves the flags in struct time_object into struct vtm for space efficiency and removes the need for packing.
This is an example of a crash:
ruby(rb_print_backtrace+0xd) [0x56848945] ../src/vm_dump.c:785
ruby(rb_vm_bugreport) ../src/vm_dump.c:1101
ruby(rb_assert_failure+0x7a) [0x56671857] ../src/error.c:878
ruby(vm_search_cc+0x0) [0x56666e47] ../src/vm_method.c:1366
ruby(rb_vm_search_method_slowpath) ../src/vm_insnhelper.c:2090
ruby(callable_method_entry+0x5) [0x568232d3] ../src/vm_method.c:1406
ruby(rb_callable_method_entry) ../src/vm_method.c:1413
ruby(gccct_method_search_slowpath) ../src/vm_eval.c:427
ruby(gccct_method_search+0x20f) [0x568237ef] ../src/vm_eval.c:476
ruby(opt_equality_by_mid_slowpath+0x2c) [0x5682388c] ../src/vm_insnhelper.c:2338
ruby(rb_equal+0x37) [0x566fe577] ../src/object.c:133
ruby(rb_big_eq+0x34) [0x56876ee4] ../src/bignum.c:5554
ruby(rb_int_equal+0x14) [0x566f3ed4] ../src/numeric.c:4640
ruby(rb_int_equal) ../src/numeric.c:4634
ruby(vm_call0_cfunc_with_frame+0x6d) [0x568303c2] ../src/vm_eval.c:148
ruby(vm_call0_cfunc) ../src/vm_eval.c:162
ruby(vm_call0_body) ../src/vm_eval.c:208
ruby(rb_funcallv_scope+0xd1) [0x56833971] ../src/vm_eval.c:85
ruby(RB_TEST+0x0) [0x567e8488] ../src/time.c:78
ruby(eq) ../src/time.c:78
ruby(small_vtm_sub) ../src/time.c:1523
ruby(timelocalw+0x23b) [0x567f3e9b] ../src/time.c:1593
ruby(time_s_alloc+0x0) [0x567f536b] ../src/time.c:3698
ruby(time_new_timew) ../src/time.c:2694
ruby(time_s_mktime) ../src/time.c:3698
--
https://bugs.ruby-lang.org/
Issue #19550 has been reported by peterzhu2118 (Peter Zhu).
----------------------------------------
Bug #19550: Memory leak in iclass for 32 bit systems
https://bugs.ruby-lang.org/issues/19550
* Author: peterzhu2118 (Peter Zhu)
* Status: Open
* Priority: Normal
* Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED
----------------------------------------
If !RCLASS_EXT_EMBEDDED (e.g. 32 bit systems) then the rb_classext_t is allocated throug malloc so it must be freed.
The issue can be seen in the following script:
```ruby
20.times do
100_000.times do
mod = Module.new
Class.new do
include mod
end
end
# Output the Resident Set Size (memory usage, in KB) of the current Ruby process
puts `ps -o rss= -p #{$$}`
end
```
Before this fix, the max RSS is 280MB, while after this change, it's 30MB.
--
https://bugs.ruby-lang.org/
Issue #19482 has been reported by peterzhu2118 (Peter Zhu).
----------------------------------------
Bug #19482: Fix crash when allocating classes with newobj hook
https://bugs.ruby-lang.org/issues/19482
* Author: peterzhu2118 (Peter Zhu)
* Status: Open
* Priority: Normal
* Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED
----------------------------------------
GitHub PR: https://github.com/ruby/ruby/pull/7464
We need to zero out the whole slot when running the newobj hook for a newly allocated class because the slot could be filled with garbage, which would cause a crash if a GC runs inside of the newobj hook.
For example, the following script crashes:
```ruby
require "objspace"
GC.stress = true
ObjectSpace.trace_object_allocations {
100.times do
Class.new
end
}
```
--
https://bugs.ruby-lang.org/
Issue #19463 has been reported by alanwu (Alan Wu).
----------------------------------------
Bug #19463: YJIT `[BUG] Stack consistency error` under certain invalidation scenarios
https://bugs.ruby-lang.org/issues/19463
* Author: alanwu (Alan Wu)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.1 (2023-02-08 revision 31819e82c8) +YJIT [arm64-darwin22]
* Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED
----------------------------------------
> test.rb:19: [BUG] Stack consistency error (sp: 15, bp: 16)
With the following:
```ruby
klass = Class.new do
def self.lookup(hash, key) = hash[key]
def self.foo(a, b) = []
def self.test(hash, key)
[lookup(hash, key), key, "".freeze]
# 05 opt_send_without_block :lookup
# 07 getlocal_WC_0 :hash
# 09 opt_str_freeze ""
# 12 newarray 3
# 14 leave
#
# YJIT will put instructions (07..14) into a block.
# When String#freeze is redefined from within lookup(),
# the return address to the block is still on-stack. We rely
# on invalidation patching the code at the return address
# to service this situation correctly.
end
end
# get YJIT to compile test()
hash = { 1 => [] }
31.times { klass.test(hash, 1) }
# inject invalidation into lookup()
evil_hash = Hash.new do |_, key|
class String
undef :freeze
def freeze = :ugokanai
end
key
end
p klass.test(evil_hash, 1)
```
The fix is fairly simple and I'll apply it shortly.
--
https://bugs.ruby-lang.org/
Issue #19600 has been reported by sawa (Tsuyoshi Sawada).
----------------------------------------
Feature #19600: Method `clamp?`
https://bugs.ruby-lang.org/issues/19600
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
----------------------------------------
Currently, we have pairs of non-predicate and predicate methods like `String#match` and `String#match?`. They are brain-friendly, and make programmers happier. Along this line, I propose the following:
1. Since by #19588, `Comparable#clamp`'s behavior is made the same as `Range#cover?` for range arguments, alias `Range#cover?` as `Range#clamp?`.
2. Synchronize the specification of `Comparable#between?` with `Comparable#clamp`, i.e.,
a. Allow `Comparable#between?` to take range arguments, and
b. Allow `Comparable#between?` to take `nil` as either or both of its arguments, or as either or both ends of its range argument.
3. Alias `Comparable#between?` as `Comparable#clamp?`
--
https://bugs.ruby-lang.org/
Issue #19544 has been reported by hurricup (Alexandr Evstigneev).
----------------------------------------
Bug #19544: Custom quotes inconsistency
https://bugs.ruby-lang.org/issues/19544
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
According to `parse_percent` in `parse.y`:
For `%` we should be able use ascii non alphanumeric delimiters.
But, `p % jim beam ;` does not work. Presumably because of some look-ahead distincting `%` from percent-string starter. Seems it is the same for any `\s` after `%`
For the explicit `%` construction, with type specifier `%[QqWwIisrx]` we should be able to use non-alphanumeric ascii characters, which includes `\s`. But:
This works:
```
p %s
jim beam
```
And this does not:
```
p %w
jim\ beam
```
with unterminated list error.
First seems unavoidable, but second looks like obvious error of finding terminating `\n`
--
https://bugs.ruby-lang.org/
Issue #19458 has been reported by joelhawksley (Joel Hawksley).
----------------------------------------
Feature #19458: Expose HEREDOC identifier
https://bugs.ruby-lang.org/issues/19458
* Author: joelhawksley (Joel Hawksley)
* Status: Open
* Priority: Normal
----------------------------------------
I’d like to have access to the HEREDOC identifier.
In the ViewComponent framework I help maintain, we added a method to declare a template as such:
```ruby
class Component
erb_template <<~ERB
<h1>Hello, <%= @name %>!</h1>
ERB
end
```
I'd prefer to be able to write:
```ruby
class Component
template <<~ERB
<h1>Hello, <%= @name %>!</h1>
ERB
end
```
And be able to see that the argument passed to `.template` was from a HEREDOC with an `ERB` identifier, which would allow me to use the correct template handler to compile the template.
I could see this being implemented:
1) As a new property of String, such as `identifier` or `heredoc_identifier`.
2) By having HEREDOCs return a subclass of String that includes an `identifier` property.
I'd be happy to work on implementing this change.
--
https://bugs.ruby-lang.org/