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 41307] New: - Single quoted command line properties are evaluated before being passed
Date Sat, 06 Jan 2007 01:18:38 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=41307>.
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=41307

           Summary: Single quoted command line properties are evaluated
                    before being passed
           Product: Ant
           Version: 1.7.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Wrapper scripts
        AssignedTo: dev@ant.apache.org
        ReportedBy: plantin@cobaltgroup.com


As of version 1.6.2, the ant launcher shell script evaluates single quoted
properties given on the command line (-D). This causes the expansion of system
variables and backtick quoted commands. This is not correct behavior for single
quoted properties.

The "ant" shell script uses: (line 38 in ant 1.7.0)

ant_exec_args="$ant_exec_args \"$arg\""

This fixes the problem: (but may not be the final solution)

ant_exec_args="$ant_exec_args '$arg'"

Here is a test that compares 1.6.1 behavior and 1.6.2, as well as 1.7.0. This
test has been run on Linux RedHat-AS 4.0u3.

Buildfile: tt.xml

linux$ ant -Dthis.variable='`cd /tmp; pwd`' -f tt.xml test
test:
     [echo] Ant version: Apache Ant version 1.6.1 compiled on February 12 2004
     [echo] this.variable: `cd /tmp; pwd`
     [exec] `cd /tmp; pwd`



BUILD SUCCESSFUL
Total time: 0 seconds
linux$ ant -Dthis.variable='`cd /tmp; pwd`' -f tt.xml test
Buildfile: tt.xml

test:
     [echo] Ant version: Apache Ant version 1.6.2 compiled on July 16 2004
     [echo] this.variable: /tmp
     [exec] /tmp

BUILD SUCCESSFUL
Total time: 0 seconds
linux$ ant -Dthis.variable='`cd /tmp; pwd`' -f tt.xml test
Buildfile: tt.xml

test:
     [echo] Ant version: Apache Ant version 1.7.0 compiled on December 13 2006
     [echo] this.variable: /tmp
     [exec] /tmp

BUILD SUCCESSFUL
Total time: 0 seconds

Ant test:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="all" basedir=".">
  <target name="all"></target>
  <target name="test">
   <echo message="Ant version: ${ant.version}"/>
   <echo message="this.variable: ${this.variable}"/>
    <exec executable="echo">
      <arg line="${this.variable}"/>
    </exec>
  </target>
</project>

-- 
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