facets icon indicating copy to clipboard operation
facets copied to clipboard

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

Open TylerRick opened this issue 3 years ago • 2 comments

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 avatar Sep 02 '20 21:09 TylerRick

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?

TylerRick avatar Sep 10 '21 20:09 TylerRick

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

jash avatar Feb 04 '22 22:02 jash