ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34018] New: - ant wrapper script can set ANT_HOME to be /opt/ant or ~/opt/ant but then overwrites the variable
Date Tue, 15 Mar 2005 15:04:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34018>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34018

           Summary: ant wrapper script can set ANT_HOME to be /opt/ant or
                    ~/opt/ant but then overwrites the variable
           Product: Ant
           Version: 1.6.2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Wrapper scripts
        AssignedTo: dev@ant.apache.org
        ReportedBy: janekdb@yahoo.co.uk


In this code from bin/ant it is possible than ANT_HOME will get set to either
/opt/ant or ~/opt/ant but then the code will proceed to overwrite ANT_HOME to be
the path of the directory the script is in. It looks as if the first two inner
if statements can be deleted without changing the script behaviour.

if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then
  # try to find ANT
  if [ -d /opt/ant ] ; then
    ANT_HOME=/opt/ant
  fi

  if [ -d "${HOME}/opt/ant" ] ; then
    ANT_HOME="${HOME}/opt/ant"
  fi

  ## resolve links - $0 may be a link to ant's home
  PRG="$0"
  progname=`basename "$0"`

  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
    else
    PRG=`dirname "$PRG"`"/$link"
    fi
  done

  ANT_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  ANT_HOME=`cd "$ANT_HOME" && pwd`
fi

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message