8230085: (fs) FileStore::isReadOnly is always true on macOS Catalina
brian.burkhalter at oracle.com
Fri Sep 13 14:42:31 UTC 2019
In macOS Catalina the system volume is replaced with a volume group consisting of a read-only system volume and a read-write data volume. The latter is at /Systems/Volumes/Data. A number of “firmlinks” (cf. /usr/share/firmlinks) define bi-directional traversal points between the read-only and read-write volumes. Examples of these are /Users and /private (which includes /private/tmp). This change caused a failure due to the algorithm used to attempt to identify the FileStore containing a given path. This algorithm using the device ID (stat.st_dev) which turns out to be the same for the system and data volumes and is therefore unreliable to this purpose.
This patch proposes to use statfs.f_mntonname to identify the volume containing a given path in step 2 of sub.nio.fs.BsdFileStore.findMountEntry(). A new method is added to retrieve f_mntonname. This could have been made an attribute but this would be redundant with the FilStore and would add attribute baggage to the file.
One question is whether f_mntonname should also be used in creating the list of FileStores.
More information about the nio-dev