RFR 8167546: enhance os::file_name_strncmp() on Mac OSX

Ioi Lam ioi.lam at oracle.com
Thu Oct 4 00:00:41 UTC 2018


Hi Gerard,

I don't know much about Mac OS, so I am just commenting from a C/C++ 
perspective:

  39 #include <unistd.h>

This file has already been included above.

   46  if (path[0] != '/') {
   47     // The path is relative, so use the current working directory
   48     char cwd[PATH_MAX];
   49     os::get_current_directory(cwd, PATH_MAX);
   50     return (pathconf(cwd, _PC_CASE_SENSITIVE) != 1);
   51   }


https://lists.apple.com/archives/darwin-dev/2007/Apr/msg00036.html 
suggests that pathconf is not reliable on NFS, SMBFS, etc.

Also, what happens if path is a symbolic link that spans across two file 
systems, where one of them is case sensitive and the other is not?

I think is_filesystem_case_insensitive could potentially return a false 
positive, which would cause two "unequal" file names to appear "equal". 
This would defeat the pathname validation in CDS.

So my recommendation is to not go ahead with this, until we have an 
actual bug report for it.

Thanks
- Ioi



On 10/03/2018 10:44 AM, Gerard Ziemski wrote:
> Hi all,
>
> Please review this fix, which allows CDS archives to be opened by using case insensitive path name on case insensitive filesystems on Mac OS X.
>
> Background: this issue only affects Mac OS X, with case insensitive filesystem, for those archives which use “ExtraSharedClassListFile” option to embed the name of the main class, when referring to the original class path using name with different letter case (in other words, uncommon).
>
> Example: we create archive using:
>
>   java -cp hello.jar -Xshare:dump -XX:ExtraSharedClassListFile=my.list -XX:SharedArchiveFile=my.jsa
>
> (where “my.list” contains "Hello”), but then later try running it using this command:
>
>   java -cp Hello.jar -Xshare:on -XX:SharedArchiveFile=my.jsa Hello
>
> (notice 1st command refers to “hello.jar”, but 2nd uses “Hello.jar”)
>
> On Mac with filesystem with case insensitive paths, this currently erroneously fails. I believe that this is technically an issue, but we have not received any real world reports complaining about this. A developer who uses different case path names and assumes that the underlaying system is case insensitive, and therefore such use case should work, is in my opinion asking for trouble, but given the time I spent on this issue so far, I’m inclined to push the fix, so that no one else needs to address it again in the future. Plus, the fix seems reasonably simple.
>
> CDS archives can be referred to by using relative paths, as in this example (i.e. “hello.jar”), but also using absolute paths (i.e. “/Volumes/Work/hello.jar”) and this fix accounts for both.
>
> Side note: interestingly enough, one can not create an archive using a relative path to a jar, and then later refer to that jar by using its absolute path, even when those are in fact the same jar file.
>
> bug: https://bugs.openjdk.java.net/browse/JDK-8167546
> webrev: http://cr.openjdk.java.net/~gziemski/8167546_rev1
> testing: Mach5 hs-tier1,2,3,4,5,6,7
>



More information about the hotspot-runtime-dev mailing list