You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2007/10/26 16:32:50 UTC

[jira] Created: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

AccessControlException when running junit tests under the ant harness in ant 1.7.0
----------------------------------------------------------------------------------

                 Key: DERBY-3153
                 URL: https://issues.apache.org/jira/browse/DERBY-3153
             Project: Derby
          Issue Type: Bug
          Components: Test
    Affects Versions: 10.4.0.0
            Reporter: Rick Hillegas


The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:

    [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
    [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
    [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
    [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
    [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
    [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
    [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
    [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
    [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
    [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
    [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

I haven't looked at the ant source, but here is my theory about what is going on:

1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives

2) The write is not wrapped in a privileged block

3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives

I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas updated DERBY-3153:
---------------------------------

    Attachment: derby-3153-sampleFix-aa.diff

Attaching derby-3153-sampleFix-aa.diff. This adds some more permissions to the default test policy, derby_tests.policy. With those permissions, I am able to start up the junit tests under the ant harness under ant 1.7.0 and they start out running without errors. That is, I don't see any initial security exceptions.

I think this could be the basis of a fix for this bug. The additional permissions would need to be propagated to the other policy files used by the tests and, of course, some time would have to be spent verifying that the tests run cleanly.

> AccessControlException when running junit tests under the ant harness in ant 1.7.0
> ----------------------------------------------------------------------------------
>
>                 Key: DERBY-3153
>                 URL: https://issues.apache.org/jira/browse/DERBY-3153
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Rick Hillegas
>         Attachments: derby-3153-sampleFix-aa.diff
>
>
> The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
>     [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
>     [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>     [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
>     [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>     [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> I haven't looked at the ant source, but here is my theory about what is going on:
> 1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives
> 2) The write is not wrapped in a privileged block
> 3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives
> I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel John Debrunner reassigned DERBY-3153:
--------------------------------------------

    Assignee: Vemund Østgaard  (was: Daniel John Debrunner)

Assign to Vemund, since that is who contributed the patch.

> AccessControlException when running junit tests under the ant harness in ant 1.7.0
> ----------------------------------------------------------------------------------
>
>                 Key: DERBY-3153
>                 URL: https://issues.apache.org/jira/browse/DERBY-3153
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Rick Hillegas
>            Assignee: Vemund Østgaard
>             Fix For: 10.4.0.0
>
>         Attachments: d3153_from3445_diff.txt, derby-3153-sampleFix-aa.diff
>
>
> The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
>     [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
>     [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>     [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
>     [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>     [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> I haven't looked at the ant source, but here is my theory about what is going on:
> 1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives
> 2) The write is not wrapped in a privileged block
> 3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives
> I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dyre Tjeldvoll updated DERBY-3153:
----------------------------------

    Fix Version/s: 10.4.0.0
         Assignee: Daniel John Debrunner

Assigning to Dan and setting fix version to 10.4

> AccessControlException when running junit tests under the ant harness in ant 1.7.0
> ----------------------------------------------------------------------------------
>
>                 Key: DERBY-3153
>                 URL: https://issues.apache.org/jira/browse/DERBY-3153
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Rick Hillegas
>            Assignee: Daniel John Debrunner
>             Fix For: 10.4.0.0
>
>         Attachments: d3153_from3445_diff.txt, derby-3153-sampleFix-aa.diff
>
>
> The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
>     [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
>     [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>     [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
>     [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>     [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> I haven't looked at the ant source, but here is my theory about what is going on:
> 1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives
> 2) The write is not wrapped in a privileged block
> 3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives
> I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572123#action_12572123 ] 

Vemund Østgaard commented on DERBY-3153:
----------------------------------------

As part of work on DERBY-3445 I have submitted a patch to that Jira that I believe also addresses the problem seen in this report. It is possible this report can be closed if the patches for DERBY-3445 are committed.

> AccessControlException when running junit tests under the ant harness in ant 1.7.0
> ----------------------------------------------------------------------------------
>
>                 Key: DERBY-3153
>                 URL: https://issues.apache.org/jira/browse/DERBY-3153
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Rick Hillegas
>         Attachments: derby-3153-sampleFix-aa.diff
>
>
> The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
>     [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
>     [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>     [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
>     [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>     [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> I haven't looked at the ant source, but here is my theory about what is going on:
> 1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives
> 2) The write is not wrapped in a privileged block
> 3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives
> I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard closed DERBY-3153.
----------------------------------

    Resolution: Fixed

I believe this issue can be closed now, as the patches checked in as part of DERBY-3445 also covered this problem. 

I've verified that updated code from trunk works when testing with ant 1.7 in my sandbox at least.

Not sure what the procedure is when closing a report that was fixed as part of work on a different report, I hope I'm not breaking any rules by just closing it now.

> AccessControlException when running junit tests under the ant harness in ant 1.7.0
> ----------------------------------------------------------------------------------
>
>                 Key: DERBY-3153
>                 URL: https://issues.apache.org/jira/browse/DERBY-3153
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Rick Hillegas
>         Attachments: d3153_from3445_diff.txt, derby-3153-sampleFix-aa.diff
>
>
> The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
>     [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
>     [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>     [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
>     [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>     [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> I haven't looked at the ant source, but here is my theory about what is going on:
> 1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives
> 2) The write is not wrapped in a privileged block
> 3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives
> I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3153) AccessControlException when running junit tests under the ant harness in ant 1.7.0

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel John Debrunner updated DERBY-3153:
-----------------------------------------

    Attachment: d3153_from3445_diff.txt

Alternate version of a fix extracted from DERBY-3445. Grants a more specific set of permissions to the ant and junit code.
Makes the junit targets in top-level build.xml have the same temp folder as the current directory (junit_timestamp).

> AccessControlException when running junit tests under the ant harness in ant 1.7.0
> ----------------------------------------------------------------------------------
>
>                 Key: DERBY-3153
>                 URL: https://issues.apache.org/jira/browse/DERBY-3153
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Rick Hillegas
>         Attachments: d3153_from3445_diff.txt, derby-3153-sampleFix-aa.diff
>
>
> The following AccessControlException occurs on junit tests run under the ant harness if the ant version is 1.7.0:
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 3, Failures: 0, Errors: 1, Time elapsed: 1.029 sec
>     [junit] Exception in thread "main" java.security.AccessControlException: access denied (java.io.FilePermission /Users/rh161140/derby/mainline/trunk/junitvmwatcher520156310.properties write)
>     [junit] 	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>     [junit] 	at java.security.AccessController.checkPermission(AccessController.java:427)
>     [junit] 	at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     [junit] 	at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
>     [junit] 	at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>     [junit] 	at java.io.FileWriter.<init>(FileWriter.java:46)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.registerNonCrash(JUnitTestRunner.java:924)
>     [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:772)
>     [junit] Running org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> I haven't looked at the ant source, but here is my theory about what is going on:
> 1) Ant 1.7.0 is trying to write a file to the directory where the ant script lives
> 2) The write is not wrapped in a privileged block
> 3) So all code domains above it on the stack need to be granted write permission on the directory where the ant script lives
> I will attach a modified version of derby_tests.policy which allows me to start up the tests without tripping across this security exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.