Treat send of using or refine as refinement#7599
Merged
headius merged 1 commit intojruby:masterfrom Jan 26, 2023
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tousingorrefineand so the refinements were never honored.This commit also treats
sendwith a literal:usingor:refinesymbol 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.