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

(fs) FileStore::isReadOnly is always true on macOS Catalina

XMLWordPrintable

    • b15
    • x86
    • os_x_10.15
    • Not verified

        ADDITIONAL SYSTEM INFORMATION :
        macOS Catalina (beta), OpenJDK 11.0.4 (but most likely this will affect any Java version)

        A DESCRIPTION OF THE PROBLEM :
        Beginning with macOS Catalina certain parts of the file system are write-protected.

        However, `Files.getFileStore(anyPath)` doesn't distinguish protected and non-protected parts and will always return the same file store, which will then be reported as read-only.

        The root path of a file system no longer defines whether the file system as a whole is read-only.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run attached test program on macOS Catalina.

        Optionally change the path variable to any other existing path residing in non-protected regions.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Program prints "read-only: false"
        ACTUAL -
        Program prints "read-only: true"

        ---------- BEGIN SOURCE ----------
        import java.io.IOException;
        import java.nio.file.Files;
        import java.nio.file.Path;
        import java.nio.file.Paths;

        public class Test {

        public static void main(String[] args) throws IOException {
        Path path = Paths.get("/tmp");
        System.out.println("read-only: " + Files.getFileStore(path).isReadOnly());
        }

        }
        ---------- END SOURCE ----------

        FREQUENCY : always


              bpb Brian Burkhalter
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              21 Start watching this issue

                Created:
                Updated:
                Resolved: