Issue #19885 has been reported by jeremyevans0 (Jeremy Evans).
----------------------------------------
Bug #19885: Invalid Warning for Default Gems That Will Move to Bundled Gems
https://bugs.ruby-lang.org/issues/19885
* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* ruby -v: ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) [x86_64-openbsd]
* Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED
----------------------------------------
Starting in ruby 3.3.0-preview2, attempting to require bigdecimal, mutex_m, base64, or other libraries that will move to bundled gems in Ruby 3.4.0 results in a warning, even when bundler is not in use:
```
$ ruby33 -v -r bigdecimal -e ''
ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) [x86_64-openbsd]
warning: bigdecimal which will be not part of the default gems since Ruby 3.4.0
```
I think such warnings are bugs if bundler is not in use. When a library is moved from a default gem to a bundled gem, such code will work fine if not using bundler. It is only when using bundler where such code would have problems, and therefore, if Ruby warns at all, it should only warn when bundler is in use.
The only time such a warning would make sense if bundler is not in use is if the library was not going to be a bundled gem. In that case, first the library should be moved from a default gem to a bundled gem, then the bundled gem that ships with Ruby should provide the warning, which you can avoid by installing an updated gem version.
Note that you also get the warning when loading a gem that has bigdecimal as a runtime dependency (this example uses Sequel 5.72.0, which has a runtime dependency on bigdecimal as you can see at https://rubygems.org/gems/sequel/versions/5.72.0):
```
$ ruby33 -v -r sequel -e ''
ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) [x86_64-openbsd]
/usr/local/lib/ruby/gems/3.3/gems/sequel-5.72.0/lib/sequel/core.rb:3: warning: bigdecimal which will be not part of the default gems since Ruby 3.4.0
```
This warning makes even less sense, because even if bigdecimal was removed as both a default gem and a bundled gem, installing Sequel 5.72.0 would install bigdecimal as a dependency.
--
https://bugs.ruby-lang.org/
Issue #19910 has been reported by segiddins (Samuel Giddins).
----------------------------------------
Bug #19910: Set#delete_if behavior inconsistent with Array/Hash
https://bugs.ruby-lang.org/issues/19910
* Author: segiddins (Samuel Giddins)
* Status: Open
* Priority: Normal
* ruby -v: 3.2.2
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
Given the following script:
```ruby
#!/usr/bin/env ruby
require 'set'
def enum(collection)
i = 0
collection.delete_if do
i += 1
raise ArgumentError if i == 6
i.odd?
end
rescue ArgumentError
return collection
end
pp enum([0, 1, 2, 3, 4, 5, 6, 7])
pp enum([0, 1, 2, 3, 4, 5, 6, 7].to_h { [_1, _1] })
pp enum([0, 1, 2, 3, 4, 5, 6, 7].to_set)
```
It results in:
```
[1, 3, 5, 6, 7]
{1=>1, 3=>3, 5=>5, 6=>6, 7=>7}
#<Set: {0, 1, 2, 3, 4, 5, 6, 7}>
```
As you can see, when an exception is raise inside `delete_if` on Hash/Array, the already-considered elements are still removed from the array. For `Set`, no elements are deleted (due to the implementation that builds up an intermediary list of elements to delete, then removes them from the underlying hash afterwards). It would be very helpful if `Set#delete_if` behaved consistently with other core collection types
--
https://bugs.ruby-lang.org/
Issue #19839 has been reported by shouichi (Shouichi KAMIYA).
----------------------------------------
Feature #19839: Need a method to check if two ranges overlap
https://bugs.ruby-lang.org/issues/19839
* Author: shouichi (Shouichi KAMIYA)
* Status: Open
* Priority: Normal
----------------------------------------
It would be convenient to have a method that checks if two ranges overlap. For example,
```
(0..10).overlap?(5..15) #=> true
(0..10).overlap?(20..30) #=> false
```
--
https://bugs.ruby-lang.org/
Issue #18984 has been updated by mame (Yusuke Endoh).
Discussed at the dev meeting. @matz said that he wanted to try to fix the behavior of Range#size instead of changing the document. If the incompatibilty is found significant, it will be reconsidered.
```ruby
(0.51..5.quo(2)).size #=> TypeError
(..0).size #=> TypeError
```
----------------------------------------
Misc #18984: Doc for Range#size for Float/Rational does not make sense
https://bugs.ruby-lang.org/issues/18984#change-104902
* Author: masasakano (Masa Sakano)
* Status: Open
* Priority: Normal
----------------------------------------
When `Range` consists of any Numeric, according to [Official docs for Ruby-3.1.2](https://ruby-doc.org/core-3.1.2/Range.html#method-i-size), `Range#size` should,
> Returns the count of elements in self if both begin and end values are numeric;
Indeed, when `Range` consists of only `Integer`, this makes sense.
However, when the begin value of `Range` is a `Float` or `Rational`, "*the count of elements*" does not make sense. Such Ranges are not iteratable, suggesting there are no such things as "elements":
```ruby
(0.51..5.quo(2)).each{} # => TypeError
```
Yet, `Range#size` of such Ranges returns an Integer
```ruby
(0.51..5.quo(2)).size # => 2
```
It seems both begin and end values of a Range are rounded (`Numeric#round`) to the nearest Integer before `Range#size` is calculated.
If this is the specification, I suggest it should be clearly stated in the [Official docs](https://ruby-doc.org/core-3.1.2/Range.html#method-i-size), avoiding the confusing expression "the count of elements", because "elements" are not unambiguously defined for Range of Float/Rational.
--
https://bugs.ruby-lang.org/
Issue #18903 has been updated by mame (Yusuke Endoh).
Discussed at the dev meeting. @nobu said he would investigate if he could fix it with M2.
Recovering from a stack overflow in C is not portable and complete, but it is a fact that they work almost well in Linux, which is the main production environment. If we make it a fatal error that cannot be rescued normally, it might impact on users of Rails apps, job queues like Sidekiq, etc.
----------------------------------------
Bug #18903: Stack overflow signal handling seems to be triggered once and then not working after
https://bugs.ruby-lang.org/issues/18903#change-104901
* Author: chrisseaton (Chris Seaton)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
This program creates a recursive object graph and then tries to convert it to JSON with no max depth, so it stack overflows in C code that does no co-operative stack overflow checks, as the bytecode interpreter would. This therefore triggers a segmentation fault and the stack overflow detection there. It works the first time, but the second time around it doesn't and the program hard crashes on M1.
Is there something like a guard page permission that is switched during the handling, and needs to switched back for the guard page to work again?
Note that it isn't JSON specific - I think any stack overflow within C code would do it.
```ruby
require 'json'
a = []
a << a
begin
JSON.dump(a)
rescue Exception
puts 'rescued'
end
JSON.dump(a)
```
--
https://bugs.ruby-lang.org/
Issue #19866 has been reported by vo.x (Vit Ondruch).
----------------------------------------
Bug #19866: Future of `readline.rb`
https://bugs.ruby-lang.org/issues/19866
* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-09-05 master 7c8932365f) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I wonder what is the future of readline.rb? It still tries to load `readline.so` by default. Is this intended behavior? I'd say that instead, it should rather fire a deprecation warning and load reline. Or maybe the whole readline gem should be completely removed?
--
https://bugs.ruby-lang.org/
Issue #13933 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Rejected
One drawback of `Range#empty?` is that we have several corner cases that cannot determine emptiness correctly (e.g., regarding exclude_end ranges or infinity).
Upon the fact we don't see the real-world use-case yet, we reject the proposal for the moment.
FYI, `Range#overlap?` has similar corner cases, it's better to document clearly somewhere.
Matz.
----------------------------------------
Feature #13933: Add Range#empty?
https://bugs.ruby-lang.org/issues/13933#change-104882
* Author: ted (Ted Johansson)
* Status: Rejected
* Priority: Normal
----------------------------------------
Range already responds to #size. It would be nice if it also responded to predicate #empty? :-)
--
https://bugs.ruby-lang.org/
Issue #18515 has been updated by matz (Yukihiro Matsumoto).
I accept this as a performance improvement.
Matz.
----------------------------------------
Feature #18515: Add Range#reverse_each implementation
https://bugs.ruby-lang.org/issues/18515#change-104881
* Author: kyanagi (Kouhei Yanagita)
* Status: Open
* Priority: Normal
----------------------------------------
PR is ~~https://github.com/ruby/ruby/pull/5489~~ https://github.com/ruby/ruby/pull/8525
Current `Range#reverse_each` uses `Enumerable#reverse_each` which is implemented with `#to_a`.
So we are virtually not able to use `reverse_each` for a very large or beginless range, even if few elements are iterated on actually.
```
(1..2**100).reverse_each { |x| p x; break if x.odd? }
(..5).reverse_each { |x| p x; break if x == 0 }
(1..2**32).reverse_each.lazy.select { |x| Prime.prime?(x) }.take(3).to_a
```
This patch, implements `Range#reverse_each` for Integer elements, enables these examples.
I think `#reverse_each` for an endless range should raise an exception.
This is a different issue, so I'll create another ticket later.
-> posted: https://bugs.ruby-lang.org/issues/18551
--
https://bugs.ruby-lang.org/
Issue #16927 has been updated by naruse (Yui NARUSE).
As nobu says, since String#tr is for codepoints, so this proposal is rejected.
Maybe though a dedicated method for this use case can be reasonable, the current use case is not enough to design it.
----------------------------------------
Bug #16927: String#tr won't return the expected result for some sign with diacritics
https://bugs.ruby-lang.org/issues/16927#change-104878
* Author: psychoslave (mathieu lovato stumpf guntz)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
# Context
Not much interest for the bug here, but I always appreciate to be given more context. So, as part of a larger project, I needed to utter every number from zero to 255 with a single syllable written as a consonant-vowel-consonant (CVC) in IPA. To avoid ambiguity, the nomenclature should not collide with existing numerical terms like "six" and "ten" in any language for which the documentation was found. As it was not enough nerdy, I came with the idea to mark with diacritics primes and congruence with 2, 8, 12, 16 (optionally and without intended phonological alteration though). If you are curious about it, you can look at [the algorithm](https://gitlab.com/psychoslave/isotopy/-/blob/master/tool/combin… I used to build the nomenclature matching [the specification](https://gitlab.com/psychoslave/isotopy/-/issues/4).
# Code to reproduce the bug
``` ruby
#!/bin/env ruby
translated = 'aeiou'.tr('aeiou', 'ą̂ę̂į̂ǫ̂ų̂')
substitued = 'aeiou'.sub(/aeiou/, 'ą̂ę̂į̂ǫ̂ų̂')
puts `ruby -v`, translated == substitued, translated, substitued
# Actual result
```
On my box, this outputs:
```
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
false
ą̂ę̂į
ą̂ę̂į̂ǫ̂ų̂
```
# Expected result
`tr` should return a congruent result: either it should fail for all signs with similar diacritics, or (preferably) return the specified Unicode glyph. That is, in the code above, `translated == substitued` should be `true`.
# Remarks
I am not a Unicode Guru: maybe the missing signs generating the difference comes from the way they are encoded. I am aware that some glyphs come in duplicates: as solo code points vs. combined code point sequences. However I'm cannot tell if the above code uses a mixture of both.
--
https://bugs.ruby-lang.org/