ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Strange property problem
Date Mon, 04 Jun 2007 19:43:59 GMT
On 6/4/07, Steve Loughran <stevel@apache.org> wrote:
> Kevin Jackson wrote:
> > Hi all,
> >
> > I have a weird error caused by a property being wrong 50% of the time
> > and correct 50% of the time.
> >
> > here's the relevant code:
> >
> > build.properties
> > james.version=server-binary-next-major
> > james.home=/var/james
> > james.home.direct=/var/james-${james.version}
> >
> > <macrodef name="ssh-cmd">
> >             <attribute name="command"/>
> >             <attribute name="fail" default="true"/>
> >             <sequential>
> >                 <sshexec host="${deploy.machine.address}"
> > port="${deploy.machine.ssh.port}"
> >                         username="root"
> > password="${deploy.machine.root.user.password}"
> >                         command="@{command}"
> >                         failonerror="@{fail}" trust="true"/>
> >             </sequential>
> >         </macrodef>
> >
> > <echo>james-${james.version}.tar.gz</echo>
> > <ssh-cmd command="cd /var;tar xzvpf
> > /root/james-${james.version}.tar.gz;chown -R james:james
> > ${james.home.direct}"/>
> >
> > Ok
> > the <echo> produces the following:
> >
> > james-server-binary-next-major.tar.gz
> >
> > in the ssh-cmd, the output of the tar xzvpf
> > /root/james-${james.version}.tar.gz
> >
> > tar xzvf /root/james-server-next-major.tar.gz
> >
> > finally the chown -r james:james ${james.home.direct}
> > fails with /var/james/james-server-binary-next-major doesn't exist
> >
> > so the echo thinks that ${james.version} = server-binary-next-major
> > the ssh-cmd macro thinks :
> > 1 - ${james.version} = server-next-major
> > 2 - then ${james.version} = server-binary-next-major
> >
> > With ant properties are immutable, so what the hell is happening?
>
> you are getting burned by the fact that the $ in the macro param is
> being double expanded. Once in passing to macrodef, and then when being
> passed to sshexec
This is yet another wild occurance of this bug.

We may need to do something about it..

Peter

>
> the first tune the command runs, the ${james.version} is not set, but
> the second time it is.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Mime
View raw message