Issue #19197 has been reported by AMomchilov (Alexander Momchilov).
----------------------------------------
Feature #19197: Add Exception#root_cause
https://bugs.ruby-lang.org/issues/19197
* Author: AMomchilov (Alexander Momchilov)
* Status: Open
* Priority: Normal
----------------------------------------
## Description
I would like to add a `#root_cause` method to `Exception`.
It returns the last exception in linked-list of causality chain, that is, the original exception (whose own `cause` is `nil`).
## Example
```ruby
e = begin
raise 'a' # This is the root cause
rescue => a
begin
raise 'b'
rescue => b
begin
raise 'c' # This is the outermost cause assigned to `e`
rescue => c
c
end
end
end
p(e) # => #<RuntimeError: c>
p(e.cause) # => #<RuntimeError: b>
p(e.cause.cause) # => #<RuntimeError: a>
p(e.cause.cause.cause) # => nil
p(e.root_cause) # => #<RuntimeError: a>
p(e.root_cause.cause) # => nil
```
# Motivation
There are some kinds of exceptions that can occur all over the place (and might be wrapped by arbitrarily many middlemen), but are attributable to a singular global cause. For example, a database outage could raise exceptions in almost every line of business logic of an app that uses ActiveRecord models.
Fundamentally, you wouldn't want an error report for every one of these lines. You'd want to look at the root cause, and bucket all SQL-connection issues into a single report, regardless of where they surface.
### Implementation
Draft PR: https://github.com/ruby/ruby/pull/6913
--
https://bugs.ruby-lang.org/
Issue #19168 has been reported by masterleep2 (Bill Lipa).
----------------------------------------
Bug #19168: "such file" is bad grammar
https://bugs.ruby-lang.org/issues/19168
* Author: masterleep2 (Bill Lipa)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
The error message for a missing required file has bad grammar:
$ irb
irb(main):001:0> require 'wuxx'
<internal:/opt/local/lib/ruby3.1/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- wuxx (LoadError)
The "such" should be removed. "cannot load file" reads more normally in English.
--
https://bugs.ruby-lang.org/
Issue #19238 has been reported by dkinzer (David Kinzer).
----------------------------------------
Bug #19238: URI.open fails for file path when second argument is a hash
https://bugs.ruby-lang.org/issues/19238
* Author: dkinzer (David Kinzer)
* Status: Open
* Priority: Normal
* ruby -v: 3.0, 3.1
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I upgraded one of my projects to ruby 3.1.3 and I found that `URI.open` now throws an error when passed a second argument when the first argument is a file path.
When the first argument is a URL, then URI.open will work as expected.
I was able to replicate this issue in all 3.x versions including the latest so it's an issue that was introduce with the release of 3.0
I found it convenient that `URI.open(uri, {})`, worked regardless of wether uri was a file path or a URL because it meant I did not have to add logic for varying cases. When the uri argument was a file path URI.open would simply open up the file and disregard the hash options params. But now I have to add that logic myself which is not as clean looking.
Below is an example of the error. It's quite easy to reproduce on any version of ruby 3.x
```
URI.open("spec/fixtures/blogs.json", {})
/Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/open-uri.rb:31:in `initialize': no implicit conversion of Hash into String (TypeError)
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/open-uri.rb:31:in `open'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/open-uri.rb:31:in `open'
from (irb):9:in `<main>'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
from /Users/dkinzer/.rbenv/versions/3.1.3/bin/irb:25:in `load'
from /Users/dkinzer/.rbenv/versions/3.1.3/bin/irb:25:in `<top (required)>'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `load'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/cli.rb:486:in `exec'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/dkinzer/.rbenv/versions/3.1.3/lib/ruby/3.1.0/bundler/cli.rb:25:in `start'
... 5 levels...
```
--
https://bugs.ruby-lang.org/
Issue #19242 has been reported by nobu (Nobuyoshi Nakada).
----------------------------------------
Bug #19242: Circular cause by Marshal
https://bugs.ruby-lang.org/issues/19242
* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
* Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
----------------------------------------
Crafted marshaled data can creates an `Exception` object with circular `cause`.
--
https://bugs.ruby-lang.org/
Issue #19243 has been reported by larskanis (Lars Kanis).
----------------------------------------
Bug #19243: Windows: Dir.home returns string in wrong encoding
https://bugs.ruby-lang.org/issues/19243
* Author: larskanis (Lars Kanis)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Create a new local user on Windows called "kanisä".
Then login to the new user and run in cmd:
```
C:\Users\kanisä>ruby -e "p Dir.home"
"C:/Users/kanis\xE4"
C:\Users\kanisä>ruby -e "p Dir.home.encoding"
#<Encoding:UTF-8>
C:\Users\kanisä>ruby -e "p Dir.home.encode('utf-8', 'iso-8859-15')"
"C:/Users/kanisä"
C:\Users\kanisä>echo %USERPROFILE%
C:\Users\kanisä
```
`Dir.home` should encode the path in UTF-8. Instead the string is labeled as UTF-8 but bytes are encoded in `iso-8859-15`.
All versions between ruby-3.0 and current master branch are affected.
--
https://bugs.ruby-lang.org/
Issue #19284 has been reported by zeke (Zeke Gabrielse).
----------------------------------------
Bug #19284: Integer overflow when using RUBY_GC_HEAP_INIT_SLOTS environment variable
https://bugs.ruby-lang.org/issues/19284
* Author: zeke (Zeke Gabrielse)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-darwin19]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
If you set the environment variable `RUBY_GC_HEAP_INIT_SLOTS` to anything other than `0`, an integer overflow runtime error occurs:
```ruby
RUBY_GC_HEAP_INIT_SLOTS=2 ruby -e 'puts "hello, world!"'
# => integer overflow: 3689348814741910508 * 8 > 18446744073709551615 (RuntimeError)
```
At this time, I'm not sure if this is platform-specific.
--
https://bugs.ruby-lang.org/
Issue #19292 has been reported by matsuda (Akira Matsuda).
----------------------------------------
Bug #19292: Time object's wday, yday, and isdst returns broken value (and so does to_a) when kwarg in: 'UTC' was given
https://bugs.ruby-lang.org/issues/19292
* Author: matsuda (Akira Matsuda)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2022-12-30T15:31:50Z master 0bb07e5ba4) +YJIT [arm64-darwin21]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').wday"
7
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').yday"
0
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').isdst"
-e:1:in `isdst': isdst is not set yet (RuntimeError)
from -e:1:in `<main>'
$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').to_a"
[0, 0, 0, 1, 1, 2023, 7, 0, true, "UTC"]
where the expected `to_a` value should be:
[0, 0, 0, 1, 1, 2023, 0, 1, false, "UTC"]
This bug seems to be happening on the following conditions:
- On any given date and time, regardless of past or future
- Either on `Time.new(Integer, Integer, ...)` style or `Time.new(String)` style
- Only when `in: 'UTC'` kwarg was given. Other formats like `in: '+0000'` or `in: 0` seems to be OK
- On all Ruby versions that accept kwarg `in:` (3.1, 3.2, and 3.3)
--
https://bugs.ruby-lang.org/
Issue #19276 has been reported by graywolf (Gray Wolf).
----------------------------------------
Misc #19276: It is not possible to reply to emails from rubymine
https://bugs.ruby-lang.org/issues/19276
* Author: graywolf (Gray Wolf)
* Status: Open
* Priority: Normal
----------------------------------------
It is no possible to reply to email from about issue update in order to add further comments to the tickets. Is that something that could be turned on? I think it would be user friendly to be able to react directly from mail client, without having to switch to the browser and navigate to the issue and comment there.
--
https://bugs.ruby-lang.org/
Issue #19189 has been reported by mistydemeo (Misty De Meo).
----------------------------------------
Bug #19189: Ruby 3.1.3/3.2.x can no longer find pkg-config if not present at buildtime
https://bugs.ruby-lang.org/issues/19189
* Author: mistydemeo (Misty De Meo)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Starting with Ruby 3.1.3, mkmf.rb calls to `pkg-config` will fail if `pkg-config` wasn't present on the system at the time it was built. Prior to that version, even if Ruby itself wasn't configured with `pkg-config`, mkmf.rb would be able to correctly pick it up from the `PATH`. This was introduced by https://github.com/ruby/ruby/commit/7f1ca666424849134990d022266bcd4d6636465f and its Ruby 3.1.3 equivalent, https://github.com/ruby/ruby/commit/3914581213e3aea138b02941b41e62c15461af27. I've confirmed that reverting this specific change fixes the problem.
This broke a Ruby deployment which is built in a minimal Docker environment with no `pkg-config`, but which is later copied into a system with `pkg-config` present.
--
https://bugs.ruby-lang.org/
Issue #19158 has been reported by deivid (David Rodríguez).
----------------------------------------
Bug #19158: Ruby 3.1.3 installs wrong gemspec for debug gem
https://bugs.ruby-lang.org/issues/19158
* Author: deivid (David Rodríguez)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
A pristine installation of Ruby 3.1.3 shows an installed `debug-1.6.3.gemspec` file that claims that debug-1.6.3 has no dependencies. This is incorrect, and causes issues for Bundler as reported at https://github.com/rubygems/rubygems/issues/6082.
An issue workaround is to manually reinstall the gem with `gem install debug:1.6.3`. That will reinstall the gem, including a correct gemspec file.
This is the file diff before and after reinstalling the gem
```diff
--- old.gemspec 2022-11-29 13:54:36
+++ /Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/specifications/debug-1.6.3.gemspec 2022-11-29 13:55:25
@@ -24,4 +24,16 @@
s.summary = "Debugging functionality for Ruby".freeze
s.installed_by_version = "3.3.26" if s.respond_to? :installed_by_version
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 4
+ end
+
+ if s.respond_to? :add_runtime_dependency then
+ s.add_runtime_dependency(%q<irb>.freeze, [">= 1.3.6"])
+ s.add_runtime_dependency(%q<reline>.freeze, [">= 0.3.1"])
+ else
+ s.add_dependency(%q<irb>.freeze, [">= 1.3.6"])
+ s.add_dependency(%q<reline>.freeze, [">= 0.3.1"])
+ end
end
```
In general, the files installed by ruby-core for bundled gems should be identical to the ones installed by explicit `gem install`.
This issue is also present in master and I'm guessing it was introduced by https://github.com/ruby/ruby/commit/a2c66f52f402cb58372e271226f3341065561e53 (backported at https://github.com/ruby/ruby/commit/2d26e45135af8b427d9ccc6d47082c21be8b9c74).
--
https://bugs.ruby-lang.org/