DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17721>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17721

problem with wrapper shell script if $0 is a relative symlink

           Summary: problem with wrapper shell script if $0 is a relative
                    symlink
           Product: Ant
           Version: 1.1
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Wrapper scripts
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


In the 'ant' shell script (module ant/src/script/ant), there is a while
loop to expand symlinks in $0 to try to find the real ANT_HOME.

This loop includes the following test, which is supposed to handle
absolute and relative paths correctly:

        if expr "$link" : '.*/.*' > /dev/null; then
                PRG="$link"
        else
                PRG=`dirname "$PRG"`"/$link"
        fi

However, this test incorrectly regards a link target like '../ant/bin/ant'
as an absolute path, so ANT_HOME gets set up wrongly.

I replaced this with the following simpler snippet:

        case "$link" in
                /*) PRG="$link" ;;
                *)  PRG=`dirname "$PRG"`"/$link" ;;
        esac

which fixes the problem.

This was on Solaris 8 sparc with Ant 1.5.2 binary distribution, but
this test hasn't changed in the latest CVS, and it looks like it will
affect all Unix distributions using this script.

Reply via email to