You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/01/26 09:03:10 UTC
[jira] Created: (HARMONY-47) java.io.FilePermissions should pay
attention to system file separator
java.io.FilePermissions should pay attention to system file separator
---------------------------------------------------------------------
Key: HARMONY-47
URL: http://issues.apache.org/jira/browse/HARMONY-47
Project: Harmony
Type: Bug
Components: Classlib
Reporter: Vladimir Ivanov
java.io.FilePermissions should pay attention to system file separator. For example, on Windows file separator is \, not /, so /* shouldn't imply /<anything>
Code to reproduce:
import java.io.*;
public class test29 {
public static void main(String args[]) throws Exception {
System.out.println(new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")) ? "FAILED" : "PASSED");
}
}
Steps to Reproduce:
1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt.
2. Compile test29.java using BEA 1.4 javac
> javac -d . test29.java
3. Run java using compatible VM (J9)
> java -showversion test29
Output:
C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
java version 1.4.2 (subset)
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
FAILED
C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
PASSED
C:\tmp\tmp17>
junit test:
------------------------ FilePermissionTest.java -------------------------------------------------
import java.io.*;
import junit.framework.*;
public class FilePermissionTest extends TestCase {
public void testFile_String() {
assertFalse("/ work as file separator", new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")));
}
public static void main(String[] args) {
junit.textui.TestRunner.run(FilePermissionTest.class);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-47) java.io.FilePermissions should pay
attention to system file separator
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-47?page=comments#action_12366250 ]
Tim Ellison commented on HARMONY-47:
------------------------------------
Vladimir,
Fixed in LUNI java.io.FilePermission at repo revision 377506.
Please check that this fully resolves your problem.
> java.io.FilePermissions should pay attention to system file separator
> ---------------------------------------------------------------------
>
> Key: HARMONY-47
> URL: http://issues.apache.org/jira/browse/HARMONY-47
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Vladimir Ivanov
> Assignee: Tim Ellison
>
> java.io.FilePermissions should pay attention to system file separator. For example, on Windows file separator is \, not /, so /* shouldn't imply /<anything>
> Code to reproduce:
> import java.io.*;
>
> public class test29 {
> public static void main(String args[]) throws Exception {
> System.out.println(new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")) ? "FAILED" : "PASSED");
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt.
> 2. Compile test29.java using BEA 1.4 javac
> > javac -d . test29.java
> 3. Run java using compatible VM (J9)
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FilePermissionTest.java -------------------------------------------------
> import java.io.*;
> import junit.framework.*;
>
> public class FilePermissionTest extends TestCase {
> public void testFile_String() {
> assertFalse("/ work as file separator", new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")));
> }
> public static void main(String[] args) {
> junit.textui.TestRunner.run(FilePermissionTest.class);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Assigned: (HARMONY-47) java.io.FilePermissions should pay
attention to system file separator
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-47?page=all ]
Tim Ellison reassigned HARMONY-47:
----------------------------------
Assign To: Tim Ellison
> java.io.FilePermissions should pay attention to system file separator
> ---------------------------------------------------------------------
>
> Key: HARMONY-47
> URL: http://issues.apache.org/jira/browse/HARMONY-47
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Vladimir Ivanov
> Assignee: Tim Ellison
>
> java.io.FilePermissions should pay attention to system file separator. For example, on Windows file separator is \, not /, so /* shouldn't imply /<anything>
> Code to reproduce:
> import java.io.*;
>
> public class test29 {
> public static void main(String args[]) throws Exception {
> System.out.println(new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")) ? "FAILED" : "PASSED");
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt.
> 2. Compile test29.java using BEA 1.4 javac
> > javac -d . test29.java
> 3. Run java using compatible VM (J9)
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FilePermissionTest.java -------------------------------------------------
> import java.io.*;
> import junit.framework.*;
>
> public class FilePermissionTest extends TestCase {
> public void testFile_String() {
> assertFalse("/ work as file separator", new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")));
> }
> public static void main(String[] args) {
> junit.textui.TestRunner.run(FilePermissionTest.class);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Resolved: (HARMONY-47) java.io.FilePermissions should pay
attention to system file separator
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-47?page=all ]
Tim Ellison resolved HARMONY-47:
--------------------------------
Resolution: Fixed
The JDK has inconsistent behavior. Consider the following test which does pass
on the JDK:
FilePermission fp1 = new FilePermission("C:" + nonSeparator + "a", "read");
FilePermission fp2 = new FilePermission("C:" + separator + "a", "read");
assertTrue("Assert 0: non-separator failed", fp1.implies(fp2));
However the spec does say: "A pathname that ends in "/*" (where "/" is the file
separator character, File.separatorChar) indicates all the files and directories
contained in that directory. A pathname that ends with "/-" indicates
(recursively) all files and subdirectories contained in that directory."
Making this change will make the lib/java.policy file platform specific.
> java.io.FilePermissions should pay attention to system file separator
> ---------------------------------------------------------------------
>
> Key: HARMONY-47
> URL: http://issues.apache.org/jira/browse/HARMONY-47
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Vladimir Ivanov
> Assignee: Tim Ellison
>
> java.io.FilePermissions should pay attention to system file separator. For example, on Windows file separator is \, not /, so /* shouldn't imply /<anything>
> Code to reproduce:
> import java.io.*;
>
> public class test29 {
> public static void main(String args[]) throws Exception {
> System.out.println(new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")) ? "FAILED" : "PASSED");
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt.
> 2. Compile test29.java using BEA 1.4 javac
> > javac -d . test29.java
> 3. Run java using compatible VM (J9)
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FilePermissionTest.java -------------------------------------------------
> import java.io.*;
> import junit.framework.*;
>
> public class FilePermissionTest extends TestCase {
> public void testFile_String() {
> assertFalse("/ work as file separator", new FilePermission("C:/*", "read").implies(new FilePermission("C:/a", "read")));
> }
> public static void main(String[] args) {
> junit.textui.TestRunner.run(FilePermissionTest.class);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira