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

ban tests from writing to CWD

    XMLWordPrintableJSON

Details

    • Test
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • New

    Description

      Currently each forked jvm has cwd = tempDir = .

      This provides some minimal protection against tests in different jvms from interfering with each other, but we can do much better by splitting these concerns: and setting cwd = . and tempDir = ./temp

      Tests that write files to CWD can confuse IDE users because they can create dirty checkouts or other issues between different runs, and of course can interfere with other tests in the same jvm (there are other possible ways to do this to).

      So a test like this should fail with SecurityException, but currently does not.

      public void testBogus() throws Exception {
        File file = new File("foo.txt");
        FileOutputStream os = new FileOutputStream(file);
        os.write(1);
        os.close();
      }
      

      Attachments

        1. LUCENE-5154.patch
          4 kB
          Robert Muir

        Activity

          People

            dweiss Dawid Weiss
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: