[ https://issues.apache.org/jira/browse/LUCENE-5650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13993921#comment-13993921 ]
Dawid Weiss commented on LUCENE-5650: ------------------------------------- [~thetaphi] pointed me at the Apache blog wrt mail problems. Bad timing. Anyway, Ryan: bq. LuceneTestCase.TEMP_DIR was created in a static block, so before the tests actually ran. Not sure what to do about that...can we initialize tempDirBase in a static block like before? Don't use static blocks in tests. Static blocks are executed during class loading and any code inside them is executed before the tests even commence. This effectively prevents any sandboxing/ checks the test runner attempts to provide. Also, it's not really predictable when these blocks will execute. The right way to execute one-time initialization in JUnit is via BeforeClass hooks or a class rule. Thanks for the patch, it looks good to me. I'll do some testing and commit it in. Sorry about the delay. > createTempDir and associated functions no longer create java.io.tmpdir > ---------------------------------------------------------------------- > > Key: LUCENE-5650 > URL: https://issues.apache.org/jira/browse/LUCENE-5650 > Project: Lucene - Core > Issue Type: Improvement > Components: general/test > Reporter: Ryan Ernst > Assignee: Dawid Weiss > Priority: Minor > Fix For: 4.9, 5.0 > > Attachments: LUCENE-5650.patch, LUCENE-5650.patch > > > The recent refactoring to all the create temp file/dir functions (which is > great!) has a minor regression from what existed before. With the old > {{LuceneTestCase.TEMP_DIR}}, the directory was created if it did not exist. > So, if you set {{java.io.tmpdir}} to {{"./temp"}}, then it would create that > dir within the per jvm working dir. However, {{getBaseTempDirForClass()}} > now does asserts that check the dir exists, is a dir, and is writeable. > Lucene uses {{"."}} as {{java.io.tmpdir}}. Then in the test security > manager, the per jvm cwd has read/write/execute permissions. However, this > allows tests to write to their cwd, which I'm trying to protect against (by > setting cwd to read/execute in my test security manager). -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org