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

(fs) Support UserDefinedFileAttributeView/extended attributes on OS X / HFS+

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd_major
    • Component/s: core-libs
    • Labels:

      Description

      A DESCRIPTION OF THE REQUEST :
      Java 1.7.0_09 doesn't support UserDefinedFileAttributeView.class on Mac OS 10.8.2. Thus Files.getFileAttributeView(VALID_PATH, UserDefinedFileAttributeView.class) always return null.

      Mac by default uses HFS+. HFS+ supports extended attributes. In my test environment, extended attribute support is proved with the following scripts:

      $ xattr -p hello test.txt
      xattr: test.txt: No such xattr: hello
      $ xattr -w hello world test.txt
      $ xattr -p hello test.txt
      world

      Reference: http://en.m.wikipedia.org/wiki/HFS_Plus

      Information of my system:

      uname -a
      Darwin MY_HOST_NAME 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

      java -version
      java version " 1.7.0_09 "
      Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
      $ diskutil list
      /dev/disk0
         #: TYPE NAME SIZE IDENTIFIER
         0: GUID_partition_scheme *251.0 GB disk0
         1: EFI 209.7 MB disk0s1
         2: Apple_HFS Macintosh HD 210.0 GB disk0s2
         3: Apple_Boot Recovery HD 650.0 MB disk0s3
         4: Microsoft Basic Data Win7 40.1 GB disk0s4
      $ diskutil info disk0s2
         Device Identifier: disk0s2
         Device Node: /dev/disk0s2
         Part of Whole: disk0
         Device / Media Name: Customer

         Volume Name: Macintosh HD
         Escaped with Unicode: Macintosh%FF%FE%20%00HD

         Mounted: Yes
         Mount Point: /
         Escaped with Unicode: /

         File System Personality: Journaled HFS+
         Type (Bundle): hfs
         Name (User Visible): Mac OS Extended (Journaled)
         Journal: Journal size 24576 KB at offset 0x11502000
         Owners: Enabled

         Partition Type: Apple_HFS




      JUSTIFICATION :
      Java is supposed to be portable. There is no reason for the missing extended attributes support on Mac, given that Mac is one of the most popular OS.

      Mac is a popular development platform for programs finally deployed to Linux/Windows/Solaris. The feature mismatch causes problem.

      There are also a lot of Java application for Mac. They can't utilitize extended attribute that is an important file system feature.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Files.getFileStore(Paths.get( " ./ " )).supportsFileAttributeView(UserDefinedFileAttributeView.class) should return true.

       Files.getFileAttributeView(Paths.get( " / " ), UserDefinedFileAttributeView.class) return a valid, non-null UserDefinedFileAttributeView instance.
      ACTUAL -
      Files.getFileStore(Paths.get( " ./ " )).supportsFileAttributeView(UserDefinedFileAttributeView.class) should return *false*.

      Files.getFileAttributeView(Paths.get( " / " ), UserDefinedFileAttributeView.class) return *null*.

      ---------- BEGIN SOURCE ----------
      /**
       * it is tested to run as root
       */
      import java.io.IOException;
      import java.nio.file.Files;
      import java.nio.file.Paths;
      import java.nio.file.attribute.UserDefinedFileAttributeView;

      public class ExtFileAttributeChecker {

          public static void main(String[] args) throws IOException {
              System.out.println(Files.getFileStore(Paths.get( " ./ " )).supportsFileAttributeView(UserDefinedFileAttributeView.class));
          }
      }
      ---------- END SOURCE ----------

        Issue Links

          Activity

          Hide
          robm Robert Mckenna added a comment -
          This has been fixed in the dev repo and is possibly out in a JDK release already.
          Show
          robm Robert Mckenna added a comment - This has been fixed in the dev repo and is possibly out in a JDK release already.
          Hide
          alanb Alan Bateman added a comment -
          The OS X port is missing a few things and support for UserDefinedFileAttributeView is one of them. It's something that we do need to look in the future.
          Show
          alanb Alan Bateman added a comment - The OS X port is missing a few things and support for UserDefinedFileAttributeView is one of them. It's something that we do need to look in the future.
          Hide
          robm Robert Mckenna added a comment -
          I stand corrected, UserDefinedFileAttributeView is missing.
          Show
          robm Robert Mckenna added a comment - I stand corrected, UserDefinedFileAttributeView is missing.

            People

            • Assignee:
              robm Robert Mckenna
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: