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 8359] - Exec task seems to disregard quotes and apostrophes in arg attribute values.
Date Wed, 24 Apr 2002 01:34:51 GMT
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=8359>.
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=8359

Exec task seems to disregard quotes and apostrophes in arg attribute values.





------- Additional Comments From jmoravec@austar.com.au  2002-04-24 01:34 -------
The find command runs perfectly when run on the actual box and when run 
remotelly using plink. I tried your examples and especially the runfind one, 
but found that it does not work. It seems that all ', &apos; and " are stripped 
from the string specified in the arg's line attribute. This results in this:

     [exec] Current OS is Windows NT
     [exec] find . -type f -exec echo {} ;
     [exec] FIND: Parameter format not correct
     [exec] Result: 2

As you can see all apostrophes/quotes disappear. I tried the following targets 
none of which worked. I am running it on a WinNT box.

  <target name="runfind">
    <exec executable="find" vmlauncher="no">
      <arg line='. -type f -exec echo "{}" ";"'/>
    </exec>
  </target>
  
  <target name="runfind2">
    <exec executable="find" vmlauncher="no">
      <arg line=". -type f -exec echo &apos;{}&apos; &apos;;&apos;"/>
    </exec>
  </target>
  
  <target name="runfind3">
    <exec executable="find" vmlauncher="no">
      <arg line=". -type f -exec echo '{}' ';'"/>
    </exec>
  </target>

I modified my original example and used <arg value=..."/> rather then <arg 
line="..."/> and avoided all white-space in attr values (otherwise the values 
get encolsed in "s). The result is very ungly, but it eventually works:

<target name="plink">
    <exec executable="plink.exe" dir="." failonerror="true">
      <arg value="-ssh" />
      <arg value="-pw" />
      <arg value="[password deleted]" />
      <arg value="itvbuild@itvapache" />
      <arg value="find" />
      <arg value="/austar_p4/html_interfaces/*" />
      <arg value="-depth" />
      <arg value="-not" />
      <arg value="\(" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files/nicko/*.xml" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files/nicko" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files/lifestyle/*.xml" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files/lifestyle" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files/channelv/*.xml" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files/channelv" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces/files" />
      <arg value="-or" />
      <arg value="-path" />
      <arg value="*/html_interfaces" />
      <arg value="\)" />
      <arg value="-exec" />
      <arg value="rm" />
      <arg value="-rf" />
      <arg value="'{}'" />
      <arg value="';'" />
    </exec>
  </target>

PS: you are right about the asterisks, they shoud be escaped.

Thanks for your help.
Jan

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


Mime
View raw message