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 ------- Additional Comments From [EMAIL PROTECTED] 2003-03-25 14:45 ------- The version from CVS HEAD gives me the same problem. Other parts of the script have changed, but the problematic test is the same. The problem is with the test at line 54 in HEAD: expr "$link" : '.*/.*' This is supposed to test if $link is an absolute path. However, what it actually tests is if $link contains a '/' character (rather than if it starts with a '/'). I also got it to work by changing this test to: expr "$link" : '^/.*' This is a smaller change than my other proposed fix. Here is an extract from the output of "sh -x ~/bin/ant" on Solaris 8 (sparc), with the script from HEAD: [...] PRG=/export/home/martin/bin/ant + basename /export/home/martin/bin/ant progname=ant + [ -h /export/home/martin/bin/ant ] + ls -ld /export/home/martin/bin/ant ls=lrwxrwxrwx 1 martin 22 Mar 25 14:18 /export/home/martin/bin/ant -> ../install/ant/bin/ant + expr lrwxrwxrwx 1 martin 22 Mar 25 14:18 /export/home/martin/bin/ant -> ../install/ant/bin/ant : .*-> \(.*\)$ link=../install/ant/bin/ant + expr ../install/ant/bin/ant : .*/.* PRG=../install/ant/bin/ant + [ -h ../install/ant/bin/ant ] + dirname ../install/ant/bin/ant ANT_HOME=../install/ant/bin/.. + cd ../install/ant/bin/.. /export/home/martin/bin/ant: ../install/ant/bin/..: does not exist ANT_HOME= [...] I've also reproduced the bug on Linux (Cobalt Linux, which I think is based on RedHat 5 point something), again with the script from HEAD: [...] + PRG=/home/sites/home/users/martin/bin/ant ++ basename /home/sites/home/users/martin/bin/ant + progname=ant + [ -h /home/sites/home/users/martin/bin/ant ] ++ ls -ld /home/sites/home/users/martin/bin/ant + ls=lrwxrwxrwx 1 martin users 22 Mar 25 13:12 /home/sites/home/users/martin/bin/ant -> ../install/ant/bin/ant ++ expr lrwxrwxrwx 1 martin users 22 Mar 25 13:12 /home/sites/home/users/martin/bin/ant -> ../install/ant/bin/ant : .*-> \(.*\)$ + link=../install/ant/bin/ant + expr ../install/ant/bin/ant : .*/.* + PRG=../install/ant/bin/ant + [ -h ../install/ant/bin/ant ] ++ dirname ../install/ant/bin/ant + ANT_HOME=../install/ant/bin/.. ++ cd ../install/ant/bin/.. /home/sites/home/users/martin/bin/ant: ../install/ant/bin/..: No such file or directory + ANT_HOME= [...] Setting ANT_HOME before running the script does work around the problem (because the test in question never gets run). Maybe this is why you can't reproduce it. Does "env - ~/bin/ant" work for you?