Bug #19445
closed
Segmentation fault with Numeric#step
Added by hsbt (Hiroshi SHIBATA) almost 2 years ago.
Updated over 1 year ago.
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
.
- 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
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.
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?
Today I learned "Associated revisions" tab in Redmine.
- 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.
- 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.
Also available in: Atom
PDF
Like0
Like0Like0Like1Like0Like0Like0Like0