Skip to content

strscan.rb move causes two copies in JRuby stdlib #38

Closed

Description

@headius

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.

Activity

  1. eregon commented on May 10, 2022

    @eregon
    Member

    In that commit, lib/jruby is added in the gemspec's require_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.rb would be simpler, as discussed in #35 (review)

  2. headius commented on May 10, 2022

    @headius
    ContributorAuthor

    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).

  3. headius commented on May 10, 2022

    @headius
    ContributorAuthor

    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.

  4. added a commit that references this issue on May 10, 2022
    2e2532d
  5. 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
  6. headius commented on May 10, 2022

    @headius
    ContributorAuthor

    I updated the title and description to reflect the actual, much-less-critical issue. #39 should fix it.

  7. headius commented on May 10, 2022

    @headius
    ContributorAuthor

    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.

  8. added 3 commits that reference this issue on May 10, 2022
    8071313
    9d7d8aa
    6b0c7f4
  9. added a commit that references this issue on May 10, 2022
  10. changed the title [-]strscan.rb move to causes two copies in JRuby stdlib[/-] [+]strscan.rb move causes two copies in JRuby stdlib[/+] on May 11, 2022
  11. added a commit that references this issue on May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions