You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
strscan.rb move causes two copies in JRuby stdlib #38
JRuby needs strscan.rb to be in the lib dir once installed, so that it can load the jar and extension. In d374f96 this file was moved to lib/jruby/strscan.rb to avoid conflicts with implementations that have their own strscan.rb. This fixes that problem, but by having two nested require paths in the gem we end up with the strscan.rb file being copied twice to the JRuby stdlib, with a confusing lib/jruby that should not exist.
The PR in #39 will move this JRuby-specific file into the ext dir and make appropriate adjustments elsewhere.
The problem is smaller than I thought. I misinterpreted a new lib/jruby/strscan.rb showing up after a clean build.
The problem, I believe, is that the require path is added rather than replaced. So when the gem is installed as a default gem, we copy the files from both require paths, lib and lib/jruby into our standard library. That ends up putting lib/jruby/strscan.rb in our stdlib directory, but also lib/jruby and that looks weird (and clearly isn't what we want).
I think the best option here might be to mimic the digest gem and put the strscan.rb for JRuby in the extension dir, adding that path to the require paths.
changed the title [-]strscan.rb move to lib/jruby breaks the gem on JRuby[/-][+]strscan.rb move to causes two copies in JRuby stdlib[/+]on May 10, 2022
Also to clarify: nothing is broken! This just ends up copying the jruby/strscan.rb file twice.
A bit of extra background info: JRuby installs default gems during our build by downloading them, installing them into a temporary location, and then copying all files from the require paths into our stdlib. Because the two require paths are nested, we end up with two copies of strscan.rb, one in jruby/strscan.rb, and that is what #39 eliminates.
Activity
eregon commentedon May 10, 2022
In that commit,
lib/jrubyis added in the gemspec'srequire_paths, isn't that enough?That should add it in $LOAD_PATH when loading the gem.
Is the problem that
require 'strscan'does not work on JRuby with--disable-gems?I agree always having the
strscan.rbwould be simpler, as discussed in #35 (review)headius commentedon May 10, 2022
The problem is smaller than I thought. I misinterpreted a new lib/jruby/strscan.rb showing up after a clean build.
The problem, I believe, is that the require path is added rather than replaced. So when the gem is installed as a default gem, we copy the files from both require paths,
libandlib/jrubyinto our standard library. That ends up puttinglib/jruby/strscan.rbin our stdlib directory, but alsolib/jrubyand that looks weird (and clearly isn't what we want).headius commentedon May 10, 2022
I think the best option here might be to mimic the digest gem and put the strscan.rb for JRuby in the extension dir, adding that path to the require paths.
Move JRuby's ext and loader script
[-]strscan.rb move to lib/jruby breaks the gem on JRuby[/-][+]strscan.rb move to causes two copies in JRuby stdlib[/+]headius commentedon May 10, 2022
I updated the title and description to reflect the actual, much-less-critical issue. #39 should fix it.
headius commentedon May 10, 2022
Also to clarify: nothing is broken! This just ends up copying the jruby/strscan.rb file twice.
A bit of extra background info: JRuby installs default gems during our build by downloading them, installing them into a temporary location, and then copying all files from the require paths into our stdlib. Because the two require paths are nested, we end up with two copies of strscan.rb, one in
jruby/strscan.rb, and that is what #39 eliminates.Move JRuby's ext and loader script
Move JRuby's ext and loader script
Ignore rogue strscan.rb file
Move JRuby's ext and loader script (#39)
[-]strscan.rb move to causes two copies in JRuby stdlib[/-][+]strscan.rb move causes two copies in JRuby stdlib[/+]Update to strscan 3.0.3