You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "philippe le berre (JIRA)" <ji...@apache.org> on 2014/11/02 12:21:33 UTC

[jira] [Updated] (DAEMON-325) missing location in location.c location_jvm_configure for Darwin

     [ https://issues.apache.org/jira/browse/DAEMON-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

philippe le berre updated DAEMON-325:
-------------------------------------
    Description: 
On OS_DARWIN the native/location.c is missing a location and java.c is missing a check/location for libverify.dylib

--- location.c.old	2014-11-01 18:53:45.000000000 +0100
+++ location.c	2014-11-01 18:54:15.000000000 +0100
@@ -144,6 +144,7 @@ char *location_jvm_default[] = {
 char *location_jvm_configured[] = {
 #if defined(OS_DARWIN)
     "$JAVA_HOME/../Libraries/lib$VM_NAME.dylib",
+    "$JAVA_HOME/jre/lib/$VM_NAME/libjvm.dylib",
 #elif defined(OS_CYGWIN)
     "$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll",              /* Sun JDK 1.3 */
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_FREEBSD) || defined(OS_TRU64)


--- /Users/rplb/java.c.orig	2014-11-02 12:00:16.000000000 +0100
+++ /Users/rplb/java.c	2014-11-02 12:16:25.000000000 +0100
@@ -135,8 +135,15 @@
 {
 #ifdef OS_DARWIN
     dso_handle apph = NULL;
-    char appf[1024];
+    char repl[1024];
     struct stat sb;
+    char *jvm_libs[] = {
+        "$JAVA_HOME/../Libraries/libjvm_compat.dylib",
+        "$JAVA_HOME/../Libraries/libappshell.dylib",
+        "$JAVA_HOME/jre/lib/libverify.dylib",
+        NULL,
+    };
+    
 #endif /* ifdef OS_DARWIN */
     jvm_create_t symb = NULL;
     JNINativeMethod nativemethods[2];
@@ -184,30 +191,33 @@
        JVM 1.4.1 through 1.5.* The library name is libjvm_compat.dylib
        starting with JVM 1.6 on OS X 10.6 the library name is libverify.dylib.
      */
-    if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libappshell.dylib",
-                "$JAVA_HOME", data->path) != 0) {
-        log_error("Cannot replace values in loader library");
-        return false;
-    }
-    if (stat(appf, &sb)) {
-        if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libjvm_compat.dylib",
-                    "$JAVA_HOME", data->path) != 0) {
+    x = 0;
+    char *appf = NULL;
+    while (jvm_libs[x] != NULL) {
+        char *orig = jvm_libs[x];
+        int k = 0;
+        
+        k = replace(repl, 1024, orig, "$JAVA_HOME", data->path);
+        if (k != 0) {
             log_error("Cannot replace values in loader library");
             return false;
         }
-    }
-    if (stat(appf, &sb)) {
-        if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libverify.dylib",
-                    "$JAVA_HOME", data->path) != 0) {
-            log_error("Cannot replace values in loader library");
-            return false;
+        
+        if (stat(repl, &sb)) {
+            log_debug("Cannot load the shell library %s", repl);
+            x++;
+        } else {
+            appf = repl;
+            break;
         }
     }
-    apph = dso_link(appf);
-    if (apph == NULL) {
-        log_error("Cannot load required shell library %s", appf);
+    
+    if (appf == NULL) {
+        log_error("Cannot load none of the required shell library");
         return false;
     }
+    
+    apph = dso_link(appf);
     log_debug("Shell library %s loaded", appf);
 #endif /* ifdef OS_DARWIN */
 #if defined(OSD_POSIX)


  was:
On OS_DARWIN the native/location.c is missing a location

--- location.c.old	2014-11-01 18:53:45.000000000 +0100
+++ location.c	2014-11-01 18:54:15.000000000 +0100
@@ -144,6 +144,7 @@ char *location_jvm_default[] = {
 char *location_jvm_configured[] = {
 #if defined(OS_DARWIN)
     "$JAVA_HOME/../Libraries/lib$VM_NAME.dylib",
+    "$JAVA_HOME/jre/lib/$VM_NAME/libjvm.dylib",
 #elif defined(OS_CYGWIN)
     "$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll",              /* Sun JDK 1.3 */
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_FREEBSD) || defined(OS_TRU64)



> missing location in location.c location_jvm_configure for Darwin
> ----------------------------------------------------------------
>
>                 Key: DAEMON-325
>                 URL: https://issues.apache.org/jira/browse/DAEMON-325
>             Project: Commons Daemon
>          Issue Type: Bug
>          Components: Jsvc
>    Affects Versions: 1.0.15
>         Environment: Mac OS X and JDK 7 
>            Reporter: philippe le berre
>            Priority: Blocker
>         Attachments: java.c.diff, location.c.diff
>
>
> On OS_DARWIN the native/location.c is missing a location and java.c is missing a check/location for libverify.dylib
> --- location.c.old	2014-11-01 18:53:45.000000000 +0100
> +++ location.c	2014-11-01 18:54:15.000000000 +0100
> @@ -144,6 +144,7 @@ char *location_jvm_default[] = {
>  char *location_jvm_configured[] = {
>  #if defined(OS_DARWIN)
>      "$JAVA_HOME/../Libraries/lib$VM_NAME.dylib",
> +    "$JAVA_HOME/jre/lib/$VM_NAME/libjvm.dylib",
>  #elif defined(OS_CYGWIN)
>      "$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll",              /* Sun JDK 1.3 */
>  #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_FREEBSD) || defined(OS_TRU64)
> --- /Users/rplb/java.c.orig	2014-11-02 12:00:16.000000000 +0100
> +++ /Users/rplb/java.c	2014-11-02 12:16:25.000000000 +0100
> @@ -135,8 +135,15 @@
>  {
>  #ifdef OS_DARWIN
>      dso_handle apph = NULL;
> -    char appf[1024];
> +    char repl[1024];
>      struct stat sb;
> +    char *jvm_libs[] = {
> +        "$JAVA_HOME/../Libraries/libjvm_compat.dylib",
> +        "$JAVA_HOME/../Libraries/libappshell.dylib",
> +        "$JAVA_HOME/jre/lib/libverify.dylib",
> +        NULL,
> +    };
> +    
>  #endif /* ifdef OS_DARWIN */
>      jvm_create_t symb = NULL;
>      JNINativeMethod nativemethods[2];
> @@ -184,30 +191,33 @@
>         JVM 1.4.1 through 1.5.* The library name is libjvm_compat.dylib
>         starting with JVM 1.6 on OS X 10.6 the library name is libverify.dylib.
>       */
> -    if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libappshell.dylib",
> -                "$JAVA_HOME", data->path) != 0) {
> -        log_error("Cannot replace values in loader library");
> -        return false;
> -    }
> -    if (stat(appf, &sb)) {
> -        if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libjvm_compat.dylib",
> -                    "$JAVA_HOME", data->path) != 0) {
> +    x = 0;
> +    char *appf = NULL;
> +    while (jvm_libs[x] != NULL) {
> +        char *orig = jvm_libs[x];
> +        int k = 0;
> +        
> +        k = replace(repl, 1024, orig, "$JAVA_HOME", data->path);
> +        if (k != 0) {
>              log_error("Cannot replace values in loader library");
>              return false;
>          }
> -    }
> -    if (stat(appf, &sb)) {
> -        if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libverify.dylib",
> -                    "$JAVA_HOME", data->path) != 0) {
> -            log_error("Cannot replace values in loader library");
> -            return false;
> +        
> +        if (stat(repl, &sb)) {
> +            log_debug("Cannot load the shell library %s", repl);
> +            x++;
> +        } else {
> +            appf = repl;
> +            break;
>          }
>      }
> -    apph = dso_link(appf);
> -    if (apph == NULL) {
> -        log_error("Cannot load required shell library %s", appf);
> +    
> +    if (appf == NULL) {
> +        log_error("Cannot load none of the required shell library");
>          return false;
>      }
> +    
> +    apph = dso_link(appf);
>      log_debug("Shell library %s loaded", appf);
>  #endif /* ifdef OS_DARWIN */
>  #if defined(OSD_POSIX)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)