Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4654023

JCK1.4: api/java_io/FilePermission/FilePermissionTests.html#impliesTests, Win ME

XMLWordPrintable

    • hopper
    • x86
    • windows
    • Verified



      Name: asR10013 Date: 03/18/2002


      Filed By : J2SE-SQA [###@###.###
      JDK : jdk1.4.1-b05
      JCK : jck1.4-b17
      Platform[s] : Windows ME
      switch/Mode : -client -Xfuture
      JCK test owner : http://javaweb.eng/jck/usr/owners.jto
      Failing test[s]: api/java_io/FilePermission/FilePermissionTests.html#impliesTests

      The test checks some assertions for java.security.FilePermission.implies method
      and that method uses java.io.File.getCanonicalPath() to get canonical pathname of
      the current user's directory.
      However, getCanonicalPath() on Windows ME returns path with ending dot when current
      directory is located on the network drive. That is unexpected for implies() method
      and the JCK test fails.

      Here is sample that demonstrates the problem:
      ----- test.java -----
      import java.io.*;
      import java.security.*;

      public class test {
      public static void main( String[] args ) throws Exception {

              String fileSep = System.getProperty("file.separator");
              // here is part of JCK test's source code
              // check(fileSep+"*", "read", fileSep+"testfile", "read", true, log);
              String cpath = fileSep+"*", cpath2 = fileSep+"testfile";
              FilePermission fp1 = new FilePermission(cpath, "read");
              FilePermission fp2 = new FilePermission(cpath2, "read");
              if(fp1.implies(fp2))
                      System.out.println("Test passed");
              else
                      System.out.println("Test FAILED");
      // end of JCK test's source code
      // check with JDK code
              System.out.println("cpath="+cpath+" mapped into="+doJDKCode(cpath) );
              System.out.println("cpath2="+cpath2+" mapped into="+doJDKCode(cpath2) );
              System.out.println("user.dir="+System.getProperty("user.dir"));
              System.out.println("getCanonicalPath(File.separator)="+new File(File.separator).getCanonicalPath());
      };

              static String doJDKCode( String cpath ) throws Exception {
                      // The code below is the same as ones in the JDK's source; file: java/io/FilePermission.java
                      if( cpath.endsWith("*") || cpath.equals("*")) {
                          //directory = true;
                          ////recursive = false;
                          cpath = cpath.substring(0, cpath.length()-1);
                      };
                      File file = new File(cpath);
                      String canonical_path = file.getCanonicalPath();
                      if( !canonical_path.endsWith(File.separator) )
                              return canonical_path + File.separator;
                      return canonical_path;
              };
      };
      ----- end of test.java -----

      Here is test output:
      ----- test output -----
      C:\>ver
                                            
      Windows Millennium [Version 4.90.3000]

      K:\bugs\hopper\b05\filepermission>net use

      Status Local name Remote name
      ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
      OK H: \\LINUX-15\EXPORT_HOME
      OK K: \\LINUX-15\JAVA_HOME
      The command was completed successfully.

      K:\bugs\hopper\b05\filepermission>pwd
      K:/bugs/hopper/b05/filepermission

      K:\bugs\hopper\b05\filepermission>c:\jdk1.4.1\bin\java -showversion test
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b05)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b05, mixed mode)

      Test FAILED
      cpath=\* mapped into=K:\.cpath2=\testfile mapped into=K:\testfileuser.dir=K:\bugs\hopper\b05\filepermission
      getCanonicalPath(File.separator)=K:\.

      K:\bugs\hopper\b05\filepermission>c:
      C:\>

      C:\>c:\jdk1.4.1\bin\java -showversion -cp k:\bugs\hopper\b05\filepermission test
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b05)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b05, mixed mode)

      Test passed
      cpath=\* mapped into=C:cpath2=\testfile mapped into=C:\testfileuser.dir=C:getCanonicalPath(File.separator)=C:
      ----- end of test output -----


      Test source location:
      =====================
      /net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/java_io/FilePermission/impliesTests.java

      jtr file location:
      ==================
      /net/jtgb4u4c.eng/export/sail15/results/hopper/b05/jck14/win32/winme_server_linux-18/workDir/api/java_io/FilePermission/FilePermissionTests_impliesTests.jtr

      How to reproduce:
      =================
      Run the following script on Windows ME (you may need to change JAVA_HOME and JCK variables).
      Please be sure that current directory is on the network-mapped disk.

      ----- script start -----
      #!/bin/sh
      JAVA_HOME=k:/jdk1.4.1/win32
      JCK=c:/jck1.4/JCK-runtime-14
      export CLASSPATH="$JCK/classes\;$JCK/javatest.jar"
      executeClass="javasoft.sqe.tests.api.java.io.FilePermission.impliesTests"
      $JAVA_HOME/bin/java -client -Xfuture -showversion -cp $CLASSPATH ${executeClass}
      ----- script end -----

      Test output:
      ============

      ----------log:(45/3727)*----------
      implies(): (\\, read) implies (\\, read) [Test Passed]
      ...
      implies(): (\\*, read) doesn't imply (\\testfile, read) [Test Failed]
      ...
      implies(): (\\-, read) doesn't imply (\\testdir\\*, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (\\testdir\\-, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (\\testfile, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (\\testdir1\\testdir2\\testfile, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (testfile, read) [Test Failed]
      ...
      implies(): (\\-, read) doesn't imply (\\testfile, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (\\testdir1\\testdir2\\testfile, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (\\..\\testfile, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (\\testdir\\testfile, read) [Test Failed]
      implies(): (\\-, read) doesn't imply (testfile, read) [Test Failed]
      ...
      implies(): (\\-, read) doesn't imply (\\testdir\\testfile, read) [Test Failed]
      ...
      implies(): (\\-, write) doesn't imply (\\testdir\\testfile, write) [Test Failed]
      ...
      implies(): (\\-, execute) doesn't imply (\\testdir\\testfile, execute) [Test Failed]
      ...
      implies(): (\\-, delete) doesn't imply (\\testdir\\testfile, delete) [Test Failed]
      ...
      STATUS:Failed. Some FilePermission.implies() tests failed (15). Check logs.
      result: Failed. Some FilePermission.implies() tests failed (15). Check logs.


      test result: Failed. Some FilePermission.implies() tests failed (15). Check logs.


      Specific Machine Info:
      ======================
      Hostname: linux-18
      OS: Windows ME

      ======================================================================

            kkladkosunw Konstantin Kladko (Inactive)
            alssunw Als Als (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: