Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6770

FSDirectory ctor should use getAbsolutePath instead of getRealPath for directory

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.2.1
    • 5.4, 6.0
    • core/store
    • None
    • OS X, Linux

    • New, Patch Available

    Description

      After upgrade from 4.1 to 5.2.1 I found that one of our test failed. Appeared the guilty was FSDirectory that converts given Path to Path.getRealPath. As result the test will fail:

      Path p = Paths.get("/var/lucene_store");
      FSDirectory d = new FSDirectory(p);
      assertEquals(p.toString(), d.getDirectory().toString());

      It because /var/lucene_store is a symlink and
      Path directory =path.getRealPath();
      resolves it to /private/var/lucene_store

      I think this is bad design decision because "direcrory" isn't just internal state but is exposed in a public interface and "getDirectory()" is widely used to initialize other components.

      It should use paths.getAbsolutePath() instead.

      build and "ant test" were successful after fix.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            uschindler Uwe Schindler
            kuzminva Vladimir Kuzmin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment