-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b06
-
linux
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 ----------
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 ----------
- duplicates
-
JDK-8149792 Support UserDefinedFileAttributeView/extended attributes on OS X / HFS+
-
- Closed
-
- relates to
-
JDK-8260966 (fs) Consolidate Linux and macOS implementations of UserDefinedFileAttributeView
-
- Resolved
-
There are no Sub-Tasks for this issue.