Bug #19445
closedSegmentation fault with Numeric#step
Description
The following commands will cause a segmentation fault.
curl -s 'https://cache.ruby-lang.org/pub/misc/ci_versions/all.json' -o ruby_versions.json
ruby -rjson -e "min = JSON.parse(File.read('ruby_versions.json')).sort.first; p 2.2.step(by: 0.1, to: min).map{|v| v.round(1).to_s }"
Note: above code is working with min.to_f
instead of min
in Numeric#step
.
Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
- Status changed from Open to Closed
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
Thanks @nobu (Nobuyoshi Nakada). I confirmed to fix this.
$ curl -s 'https://cache.ruby-lang.org/pub/misc/ci_versions/all.json' -o ruby_versions.json
ruby -v -rjson -e "min = JSON.parse(File.read('ruby_versions.json')).sort.first; p 2.2.step(by: 0.1, to: min).map{|v| v.round(1).to_s }"
ruby 3.3.0dev (2023-02-18T05:49:21Z master de7eb5e79a) +YJIT [arm64-darwin21]
-e:1:in `step': no implicit conversion to float from string (TypeError)
from -e:1:in `each'
from -e:1:in `map'
from -e:1:in `<main>'
and also confirmed this issue happened with Ruby 3.0, 3.1 and 3.2.
Updated by byroot (Jean Boussier) almost 2 years ago
Apologies, but I'm a bit confused. I see @nobu (Nobuyoshi Nakada) marked the issue as closed with needing backport, but I don't see any associated fix. Did I miss something?
Updated by nobu (Nobuyoshi Nakada) almost 2 years ago
https://bugs.ruby-lang.org/issues/19445?tab=changesets
I missed the space between Bug
and #
, then linked manually.
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
Today I learned "Associated revisions" tab in Redmine.
Updated by naruse (Yui NARUSE) almost 2 years ago
- Backport changed from 2.7: DONTNEED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE
ruby_3_2 59eb18037ff92839be48fb6c46ff0acc179b4f4c merged revision(s) dd28c55a7cd6780dad637b4d6a20507fbfc6af4a.
Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago
- Backport changed from 2.7: DONTNEED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE to 2.7: DONTNEED, 3.0: REQUIRED, 3.1: DONE, 3.2: DONE
ruby_3_1 5428bdc1daed12d1e142a854fc037a1a4eb647c9 merged revision(s) dd28c55a7cd6780dad637b4d6a20507fbfc6af4a.