JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6172

Requiring a file from a JAR that has a path inside the JAR that coincides with a path on the file system that includes a symlink fails

    Details

    • Number of attachments :
      2

      Description

      It all boils down to org.jruby.runtime.load.LoadService#expandRelativeJarPath using File#getCanonicalPath to expand the JAR entry path. A quick fix is to change expandRelativeJarPath like this:

          private String expandRelativeJarPath(String path) {
              return path.replaceAll("/[^/]+/\\.\\.|[^/]+/\\.\\./|\\./","").replace("^\\\\","/");
          }
      

      This passes all existing tests and fixes the problem. I can add a test and submit a patch if desired.

        Activity

        Hide
        Hiro Asari added a comment -

        Uwe,

        Thanks for the test and the patch. I've pushed them to the master branch (d956b62 and 080e23d).

        Show
        Hiro Asari added a comment - Uwe, Thanks for the test and the patch. I've pushed them to the master branch (d956b62 and 080e23d).
        Hide
        Uwe Kubosch added a comment -

        Thanks!

        Show
        Uwe Kubosch added a comment - Thanks!
        Hide
        Uwe Kubosch added a comment -

        Hi!

        Could you push the patch to the jruby-1_6 branch as well?

        I am experiencing a severe performance regression with JRuby 1.7.0.dev, and would very much like to revert to JRuby 1.6.6.dev if possible.

        Show
        Uwe Kubosch added a comment - Hi! Could you push the patch to the jruby-1_6 branch as well? I am experiencing a severe performance regression with JRuby 1.7.0.dev, and would very much like to revert to JRuby 1.6.6.dev if possible.
        Hide
        Hiro Asari added a comment -

        I cherry-picked them to the 1.6 branch: b087f3f and 4316fda.

        Show
        Hiro Asari added a comment - I cherry-picked them to the 1.6 branch: b087f3f and 4316fda.
        Hide
        Uwe Kubosch added a comment -

        Thanks!

        Show
        Uwe Kubosch added a comment - Thanks!

          People

          • Assignee:
            Hiro Asari
            Reporter:
            Uwe Kubosch
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: