palkan / anyway_config

Configuration library for Ruby gems and applications
MIT License
778 stars 52 forks source link

Random segfaults with Rails on Ruby 2.7 #100

Closed palkan closed 2 years ago

palkan commented 2 years ago

See https://bugs.ruby-lang.org/issues/17382

Although that's definitely an MRI issue, we can fix it at our end. The feature is used for pretty printing:

https://github.com/palkan/anyway_config/blob/f1b38ddc6033cfc8f4ea019d5e8e64ea198d6cac/lib/anyway/tracing.rb#L8-L13

We can either make it explicit or, maybe, using a unique name would work:

using(Module.new do
  refine Object do
     alias __pp__ inspect
  end

  refine Hash do
     def __pp__
       # ...
     end
  end
end)

And then call v.__pp__ for all the printed values.

palkan commented 2 years ago

Should be fixed in 2.3.0