diff options
author | Sven Gothel <[email protected]> | 2013-10-23 16:48:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-23 16:48:42 +0200 |
commit | fec9712b151ad31b053fe700cb0f809b9715407c (patch) | |
tree | 92201b96715373aa2ac7e13940226864fd65be0d /src/java/com/jogamp/common/util/JarUtil.java | |
parent | 55cc188f0f076a046d05a49c1c82bb90ba545117 (diff) |
Fix Bug 865: Safari >= 6.1 [OSX]: May employ xattr on 'com.apple.quarantine' on 'PluginProcess.app'
- IOUtil.getTempDir(..): Don't test executable caps on OSX for java_io_tmpdir
- JarUtil.extract(..): Issue native fixNativeLibAttribs(..) on OSX for native library files,
i.e. remove xattr 'com.apple.quarantine'
Diffstat (limited to 'src/java/com/jogamp/common/util/JarUtil.java')
-rw-r--r-- | src/java/com/jogamp/common/util/JarUtil.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java index 5411d66..b5f8850 100644 --- a/src/java/com/jogamp/common/util/JarUtil.java +++ b/src/java/com/jogamp/common/util/JarUtil.java @@ -47,6 +47,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import com.jogamp.common.os.NativeLibrary; +import com.jogamp.common.os.Platform; import jogamp.common.Debug; @@ -632,6 +633,7 @@ public class JarUtil { if (isNativeLib && ( isRootEntry || !nativeLibMap.containsKey(libBaseName) ) ) { nativeLibMap.put(libBaseName, destFile.getAbsolutePath()); addedAsNativeLib = true; + fixNativeLibAttribs(destFile); } } if (DEBUG) { @@ -643,6 +645,32 @@ public class JarUtil { } /** + * Mitigate file permission issues of native library files, i.e.: + * <ul> + * <li>Bug 865: Safari >= 6.1 [OSX]: May employ xattr on 'com.apple.quarantine' on 'PluginProcess.app'</li> + * </ul> + */ + private final static void fixNativeLibAttribs(File file) { + // We tolerate UnsatisfiedLinkError (and derived) to solve the chicken and egg problem + // of loading gluegen's native library. + // On Safari(OSX), Bug 865, we simply hope the destination folder is executable. + if( Platform.OSType.MACOS == Platform.getOSType() ) { + final String fileAbsPath = file.getAbsolutePath(); + try { + fixNativeLibAttribs(fileAbsPath); + if( DEBUG ) { + System.err.println("JarUtil.fixNativeLibAttribs: "+fileAbsPath+" - OK"); + } + } catch (Throwable t) { + if( DEBUG ) { + System.err.println("JarUtil.fixNativeLibAttribs: "+fileAbsPath+" - "+t.getClass().getSimpleName()+": "+t.getMessage()); + } + } + } + } + private native static boolean fixNativeLibAttribs(String fname); + + /** * Validate the certificates for each native Lib in the jar file. * Throws an IOException if any certificate is not valid. * <pre> |