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

java.io.File.mkdir() ignores umask

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • core-libs
    • sparc
    • solaris_2.5



      Name: akC57697 Date: 04/23/98



      The java.io.File.mkdir() ignores umask settings when creates a directory.
      The reason is a hard-coded mask in source of native method:

      "
      Java_java_io_File_mkdir0(JNIEnv *env, jobject this)
      {
        .........................
          result = JVM_Mkdir(platformPath, 0771) != -1;
                                           ^^^^^
      "

      ---------------------8-<----------------------
      public class testFile {
        public static void main(String argv[]) {
         java.io.File f= new java.io.File("test_dir");
         f.mkdir();
        }
      }
      --------------------->-8----------------------
      Set umask to -rw-rw-r--
      umask 2
      java testFile
      drwxrwx--x 2 kuzm 512 Apr 23 13:58 test_dir/
      ^^^^^^^^^^
      ======================================================================

            Unassigned Unassigned
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: