rubyworks / facets

Ruby Facets
http://rubyworks.github.com/facets
Other
798 stars 100 forks source link

Upgrading tzinfo to 1.2.7 causes: undefined method `untaint' for class `Enumerable::Recursor' #295

Open TylerRick opened 4 years ago

TylerRick commented 4 years ago

In my Rails project, when I upgraded tzinfo to 1.2.7 it caused this error whenever I tried to boot the app:

      facets/lib/core/facets/enumerable/recursively.rb:19:in `private': undefined method `untaint' for class `Enumerable::Recursor'

I was able to reproduce in more minimal context with:

      require 'tzinfo/ruby_core_support'
      class C; private :untaint; end

It looks like 'tzinfo/ruby_core_support' adds untaint method to Object using a refinement, which somehow isn't compatible with what facets does. Anyone have an idea how to fix this on the facets side?

Maybe as simple as just adding untaint as an exception to this line (which caused the error)?:

    instance_methods(true).each{ |m| private m unless /^(__|object_id$)/ =~ m.to_s }

but that seems brittle.

Why are we making these private anyway? Is there a better way we could do this? BasicObject?

TylerRick commented 3 years ago

A workaround for now is to just lock to:

gem 'tzinfo', '1.2.5'

... but eventually we'll be forced to upgrade tzinfo, so we'll need an actual solution.

Has anyone come up with a better/actual solution to this?

jash commented 2 years ago

This is still happening. Any other ideas for fixing this?