Summary: | [patch] java/openjdk7: force filesystemprovider to bsd | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | 4721 <4721> | ||||||
Component: | Individual Port(s) | Assignee: | Greg Lewis <glewis> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | ||||||||
Priority: | Normal | ||||||||
Version: | Latest | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
4721@hushmail.com
2012-11-22 22:50:00 UTC
Responsible Changed From-To: freebsd-ports-bugs->glewis Over to maintainer (via the GNATS Auto Assign Tool) Hi Greg, The submitter of this PR tells me that this is to work around a bug in Minecraft; it will only launch and run if os.name=linux here. Now, this is certainly a bug there, but I'm not sure how likely they are to actually fix their software (it being non-Free), but do you see any harm in this patch? It should be temporary, but it's the last fix required to get minecraft to transition to openjdk7 where it actually works. Do you have any ideas on alternatives? I can't see it being harmful, anyway. Of course I'll work with upstream of Minecraft to try to fix their software too... Chris On Wed, Jan 16, 2013 at 07:50:00PM +0000, Chris Rees wrote: > The submitter of this PR tells me that this is to work around a bug in > Minecraft; it will only launch and run if os.name=linux here. > > Now, this is certainly a bug there, but I'm not sure how likely they > are to actually fix their software (it being non-Free), but do you see > any harm in this patch? It should be temporary, but it's the last fix > required to get minecraft to transition to openjdk7 where it actually > works. > > Do you have any ideas on alternatives? I can't see it being harmful, > anyway. Of course I'll work with upstream of Minecraft to try to fix > their software too... My main problem is that it's a big hack. I can't put this back into the official port repo since it obviously breaks actual Linux systems. So even if we were to get all of our changes into an official OpenJDK release, this would still be a problem that would require a patch and building from source. The other solution I was looking at was that if you take a look at jdk/src/share/classes/java/nio/file/FileSystems.java it looks at the property java.nio.file.spi.DefaultFileSystemProvider to determine the FileSystemProvider to use. We could potentially override things using that property. To make that work we need a small patch to jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java that provides a constructor that takes another FileSystemProvider. Then it can be specified as the value of the property above and things should work. Not sure if the submitter can try that out? Something like this (untested): --- jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java Wed Jan 16 16:04:50 2013 -0800 +++ jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java Wed Jan 16 21:48:59 2013 -0800 @@ -27,6 +27,7 @@ import java.nio.file.*; import java.nio.file.attribute.*; +import java.nio.file.spi.FileSystemProvider; import java.io.IOException; /** @@ -38,6 +39,10 @@ super(); } + public BsdFileSystemProvider(FileSystemProvider f) { + super(); + } + @Override BsdFileSystem newFileSystem(String dir) { return new BsdFileSystem(this, dir); -- Greg Lewis Email : glewis@eyesbeyond.com Eyes Beyond Web : http://www.eyesbeyond.com Information Technology FreeBSD : glewis@FreeBSD.org openjdk7 seems to want to create default filesystem provider, then recreate with the value you set in the property. the initial default creation still tries to load the nonexistent linux provider and causes exit: Exception in thread "main" java.lang.AssertionError: java.lang.ClassNotFoundException: sun/nio/fs/LinuxFileSystemProvider modified patch examines java.nio.file.spi.DefaultFileSystemProvider inside default filesystem provider creation process and overrides it there if set. works as: -Djava.nio.file.spi.DefaultFileSystemProvider=sun.nio.fs.BsdFileSystemProvider the original issue is also solved, reading files works with patch again. Author: glewis Date: Wed Mar 27 03:06:50 2013 New Revision: 315345 URL: http://svnweb.freebsd.org/changeset/ports/315345 Log: . Allow users to force the file system provider to be the BSD file system provider. This is helpful when users also wish to force os.name to a different value (e.g. Linux) but not being forced to also use the Linux file system provider. This can be done by defining the property java.nio.file.spi.DefaultFileSystemProvider. This patch differs from the submitters in that the range of values are restricted to the current known defaults. PR: 173847 Submitted by: 4721 at hushmail.com Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-BsdFileSystemProvider.java (contents, props changed) head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-DefaultFileSystemProvider.java (contents, props changed) Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-BsdFileSystemProvider.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-BsdFileSystemProvider.java Wed Mar 27 03:06:50 2013 (r315345) @@ -0,0 +1,21 @@ +--- jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java.orig ++++ jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java +@@ -27,6 +27,7 @@ + + import java.nio.file.*; + import java.nio.file.attribute.*; ++import java.nio.file.spi.FileSystemProvider; + import java.io.IOException; + + /** +@@ -38,6 +39,10 @@ + super(); + } + ++ public BsdFileSystemProvider(FileSystemProvider f) { ++ super(); ++ } ++ + @Override + BsdFileSystem newFileSystem(String dir) { + return new BsdFileSystem(this, dir); Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-DefaultFileSystemProvider.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-DefaultFileSystemProvider.java Wed Mar 27 03:06:50 2013 (r315345) @@ -0,0 +1,37 @@ +--- jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java Sun Mar 10 14:04:37 2013 -0400 ++++ jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java Tue Mar 26 18:25:51 2013 -0700 +@@ -28,6 +28,8 @@ + import java.nio.file.spi.FileSystemProvider; + import java.security.AccessController; + import java.security.PrivilegedAction; ++import java.util.Set; ++import java.util.HashSet; + import sun.security.action.GetPropertyAction; + + /** +@@ -37,6 +39,14 @@ + public class DefaultFileSystemProvider { + private DefaultFileSystemProvider() { } + ++ private static final Set<String> validFileSystemProviders ++ = new HashSet<String>(); ++ static { ++ validFileSystemProviders.add("sun.nio.fs.SolarisFileSystemProvider"); ++ validFileSystemProviders.add("sun.nio.fs.LinuxFileSystemProvider"); ++ validFileSystemProviders.add("sun.nio.fs.BsdFileSystemProvider"); ++ } ++ + @SuppressWarnings("unchecked") + private static FileSystemProvider createProvider(final String cn) { + return AccessController +@@ -64,6 +74,10 @@ + public static FileSystemProvider create() { + String osname = AccessController + .doPrivileged(new GetPropertyAction("os.name")); ++ String fileSystemProvider = System ++ .getProperty("java.nio.file.spi.DefaultFileSystemProvider"); ++ if (validFileSystemProviders.contains(fileSystemProvider)) ++ return createProvider(fileSystemProvider); + if (osname.equals("SunOS")) + return createProvider("sun.nio.fs.SolarisFileSystemProvider"); + if (osname.equals("Linux")) _______________________________________________ svn-ports-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-ports-all To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org" State Changed From-To: open->closed Sorry for the delay. I've committed a modified patch which I think is a little safer. Let me know if you have any problems with it. |