Skip to content

Treat send of using or refine as refinement#7599

Merged
headius merged 1 commit intojruby:masterfrom
headius:send_using_refine
Jan 26, 2023
Merged

Treat send of using or refine as refinement#7599
headius merged 1 commit intojruby:masterfrom
headius:send_using_refine

Conversation

@headius
Copy link
Member

@headius headius commented Jan 26, 2023

The tzinfo gem at some point started using send(:using ...) to get around a JRuby arity bug. Unfortunately this breaks our detection of refinements, which depends on seeing a direct call to using or refine and so the refinements were never honored.

This commit also treats send with a literal :using or :refine symbol as a call to the related method.

At some point we may simply have to accept that all scopes could be refined, but this is an ok fix for a very specific and unusual situation.

See tzinfo/tzinfo#145 for the issue reported to tzinfo about all our untaint warnings, which should have been masked by refinement.

The tzinfo gem at some point started using `send(:using ...)` to
get around a JRuby arity bug. Unfortunately this breaks our
detection of refinements, which depends on seeing a direct call to
`using` or `refine` and so the refinements were never honored.

This commit also treats `send` with a literal `:using` or
`:refine` symbol as a call to the related method.

At some point we may simply have to accept that all scopes could
be refined, but this is an ok fix for a very specific and unusual
situation.

See tzinfo/tzinfo#145 for the issue
reported to tzinfo about all our untaint warnings, which should
have been masked by refinement.
@headius headius added this to the JRuby 9.4.1.0 milestone Jan 26, 2023
@headius headius merged commit 311f21a into jruby:master Jan 26, 2023
@headius headius deleted the send_using_refine branch January 26, 2023 18:58
philr added a commit to tzinfo/tzinfo that referenced this pull request Jan 28, 2023
Despite using the UntaintExt refinement that replaces Object#untaint,
JRuby 9.4.0.0 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).
JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be
allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599).

Replace the UntaintExt refinement with an untaint method (in the now
reinstanted RubyCoreSupport module).

Change tests for handling of tainted inputs to skip when taint/untaint
is undefined or a no-op. There's no point in running these tests unless
the inputs are actually tainted. Remove the (test-only) TaintExt
refinement too.

Resolves #145.
philr added a commit to tzinfo/tzinfo that referenced this pull request Jan 28, 2023
Despite using the UntaintExt refinement that replaces Object#untaint,
JRuby 9.4.0.0 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).
JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be
allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599).

Replace the UntaintExt refinement with an untaint method in
RubyCoreSupport.

Change tests for handling of tainted inputs to skip when taint/untaint
is undefined or a no-op. There's no point in running these tests unless
the inputs are actually tainted. Remove the (test-only) TaintExt
refinement too.

Resolves #145.
philr added a commit to tzinfo/tzinfo that referenced this pull request Jan 28, 2023
Despite using the UntaintExt refinement that replaces Object#untaint,
JRuby 9.4.0.0 calls the original Object#untaint method and outputs
warnings as a result:

warning: Object#untaint is deprecated and will be removed in Ruby 3.2

This is caused by the unorthodox `send(:using, UntaintExt)` approach
being used to deal with issues with older JRuby versions (see #114).
JRuby 9.4.0.0 doesn't detect this as using the refinement. This will be
allowed again in JRuby 9.4.1.0 (see jruby/jruby#7599).

Replace the UntaintExt refinement with an untaint method in
RubyCoreSupport (now reinstated having previously been removed in
2.0.0).

Change tests for handling of tainted inputs to skip when taint/untaint
is undefined or a no-op. There's no point in running these tests unless
the inputs are actually tainted. Remove the (test-only) TaintExt
refinement too.

Resolves #145.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant