Project

General

Profile

Actions

Bug #19445

closed

Segmentation fault with Numeric#step

Added by hsbt (Hiroshi SHIBATA) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:112459]

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.

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 1 year 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) over 1 year 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) over 1 year 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) over 1 year 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) over 1 year ago

Today I learned "Associated revisions" tab in Redmine.

Updated by naruse (Yui NARUSE) over 1 year 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) over 1 year 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like1Like0Like0Like0Like0