realpath: : No such file or directory

Mike Jakubik mike.jakubik at intertainservices.com
Wed May 12 19:50:36 UTC 2010



On 5/12/2010 3:07 PM, Kostik Belousov wrote:
>
> The realpath(1) was given an empty path.
>
> According to SUSv4, realpath(3) should return ENOENT if "A component of
> file_name does not name an existing file or file_name points to an empty
> string." This was recently brought into standard compliance.
>
> Why javavm passes empty path to realpath(1), I do not know.
>    

It appears the cause is because ${JAVA_HOME} is an empty variable.

---
#
# Set up an appropriate JAVA_HOME
#
setJavaHome() {

echo Debug JAVA_HOME:  ${JAVA_HOME}
echo Debug JAVAVM_PREFIX: ${_JAVAVM_PREFIX}

     # Use JAVA_HOME if it's set, unless its set to /usr/local
     if [ -n "${JAVA_HOME}" -a \
          "`realpath "${JAVA_HOME}"`" != "`realpath 
"${_JAVAVM_PREFIX}"`" ]; then
         if [ -n "${JAVA_HOME}" -a -f "${JAVA_HOME}/bin/${_JAVAVM_PROG}" 
]; then
             _JAVAVM_PROG_PATH="${JAVA_HOME}/bin"
             return 0
         elif [ -n "${JAVA_HOME}" -a \
                -f "${JAVA_HOME}/jre/bin/${_JAVAVM_PROG}" ]; then
             _JAVAVM_PROG_PATH="${JAVA_HOME}/jre/bin"
             return 0
         fi
     fi

     unset JAVA_HOME
---

When i run the above:

+ setJavaHome
+ echo Debug JAVA_HOME:
Debug JAVA_HOME:
+ echo Debug JAVAVM_PREFIX: /usr/local
Debug JAVAVM_PREFIX: /usr/local
+ realpath ''
realpath: : No such file or directory



More information about the freebsd-java mailing list