realpath: : No such file or directory

Jung-uk Kim jkim at FreeBSD.org
Thu May 13 23:53:44 UTC 2010


On Thursday 13 May 2010 06:46 pm, Jung-uk Kim wrote:
> On Wednesday 12 May 2010 03:50 pm, Mike Jakubik wrote:
> > 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
>
> The attached patch should fix the annoyance.

FYI, the maintainer approved the patch and I just committed it.

Jung-uk Kim


More information about the freebsd-java mailing list