[cp-patches] FYI: Fix FilePermission on root directory

Gary Benson gbenson at redhat.com
Thu Jun 29 09:26:03 UTC 2006


Hi all,

This commit fixes a bug whereby FilePermission("/") did not imply
itself.  There was some old (and broken) code for compensating for
paths with trailing separators.  Nowadays paths are canonicalized;
canonical paths never have trailing separators, so I just junked
the old code.

Cheers,
Gary
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.7965
diff -u -r1.7965 ChangeLog
--- ChangeLog	28 Jun 2006 20:10:25 -0000	1.7965
+++ ChangeLog	29 Jun 2006 09:01:35 -0000
@@ -1,3 +1,7 @@
+2006-06-29  Gary Benson  <gbenson at redhat.com>
+
+	* java/io/FilePermission.java (implies): Work when path is "/".
+
 2006-06-28  Andrew John Hughes  <gnu_andrew at member.fsf.org>
 
 	* java/lang/Thread.java:
Index: java/io/FilePermission.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/FilePermission.java,v
retrieving revision 1.21
diff -u -r1.21 FilePermission.java
--- java/io/FilePermission.java	29 Mar 2006 15:33:24 -0000	1.21
+++ java/io/FilePermission.java	29 Jun 2006 09:01:35 -0000
@@ -274,12 +274,7 @@
 	break;
 
       default:
-	if (f2.charAt(f2.length() - 1) == File.separatorChar)
-	  {
-	    if (! f1.equals(f2.substring(0, f2.length() - 1)))
-	      return false;
-	  }
-	else if (!f1.equals(f2))
+	if (!f1.equals(f2))
 	  return false;
 	break;
       }


More information about the Classpath-patches mailing list