Project

General

Profile

Actions

Bug #16759

closed

MinGW 2.5 - SEGV bug with Binding#local_variable_set

Added by MSP-Greg (Greg L) about 4 years ago. Updated almost 3 years ago.

Status:
Closed
Target version:
-
ruby -v:
Ruby MinGW 2.5
[ruby-core:97724]

Description

A failure with MinGW 2.5.8 appeared in ruby/spec CI from the below in core/binding/local_variable_set_spec.rb. I believe the specs passed on 2.5.7:

it "raises a NameError on global access" do
  bind = binding
  -> { bind.local_variable_set(:$0, "") }.should raise_error(NameError)
end

it "raises a NameError on special variable access" do
  bind = binding
  -> { bind.local_variable_set(:$~, "") }.should raise_error(NameError)
  -> { bind.local_variable_set(:$_, "") }.should raise_error(NameError)
end

Working locally, the below code failed on both 2.5.7 and 2.5.8, but passed on mswin head & MinGW 2.6 thru head:

[:$0, :$~, :$_].each do |v|
  a = -> (bind) do
    bind.local_variable_set(v, '')
  end
  begin
    a[binding]
  rescue => e
    puts "#{v}  #{e.class}"
  end

I checked other uses, see https://github.com/MSP-Greg/ruby-testing/blob/master/binding-local-variable.rb. I ran the file in Actions CI on both Ubuntu & Windows, see the 'binding issue' step on any job at:
https://github.com/MSP-Greg/ruby-testing/actions/runs/71232731

Updated by MSP-Greg (Greg L) about 4 years ago

Thanks to the work by @Eregon (Benoit Daloze) in ruby/setup-ruby, the issue first appeared in 2.5.6.

Passed
ruby 2.4.10p364

ruby 2.5.0p0
ruby 2.5.1p57
ruby 2.5.3p105
ruby 2.5.5p157

ruby 2.6.0p0

Failed
ruby 2.5.6p201

See:
https://github.com/MSP-Greg/ruby-testing/actions/runs/71387353

Updated by Eregon (Benoit Daloze) almost 4 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

Could someone take a look at this please?
It seems a pretty serious bug to segfault/abort when using Binding#local_variable_set.
cc @nobu (Nobuyoshi Nakada) @usa (Usaku NAKAMURA)

Updated by Eregon (Benoit Daloze) almost 4 years ago

Ping.
This still happens and is annoying as it fails consistently in ruby/spec's CI (e.g., https://github.com/ruby/spec/pull/774).
I will now exclude it there, but the bug is still present.

Updated by jeremyevans0 (Jeremy Evans) almost 3 years ago

  • Status changed from Open to Closed

As this appears fixed in Ruby 2.6+, and Ruby 2.5 is out of support, I'm going to close this.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0