Details
Description
Having upgraded to commons-daemon 1.0.11 from 1.0.10, we are now no longer able to start our service because Java Home cannot be located.
In our particular use case we do not set JAVA_HOME as an environment variable but instead specify it using the -home parameter on the jsvc command line. However I have tried using an environment variable and the result is the same: the jsvc fails to find the Java Home directory.
Having looked at the source code, I think the error is due to a recent change to home.c. In particular, the following on lines 215 to 221:
if (path == NULL || *path == '\0' || *path == '/') { log_debug("Home not specified on command line, using environment"); path = getenv("JAVA_HOME"); if (path == NULL || *path == '\0' || *path == '/') { /* guard against empty JAVA_HOME */ path = NULL; } }
The use of '==' to compare strings here is incorrect; the strcmp() function should be used instead. Currently, the code will fail if the first character of the path is '/', which is invariably the case on Linux, UNIX or MacOS systems. I suspect the reason that this has not been detected sooner is because MacOS and Ubuntu/Debian have been special-cased elsewhere to hard-code the expected Java Home location.
For us this is a blocker so we have reverted to using 1.0.10 until it is fixed. We also have a patch which I will attach to this issue shortly.
Attachments
Attachments
Issue Links
- is duplicated by
-
DAEMON-272 jsvc ignores -home option
- Resolved