ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Corveleyn <jcor...@gmail.com>
Subject Re: ant wrapper script testing
Date Fri, 28 Oct 2016 20:41:08 GMT
On Wed, Oct 26, 2016 at 4:16 PM, Jeff Adamson <jwadamson@us.ibm.com> wrote:
>
> I am feeling pretty good as the introduction of the newline to the printf
> does not fundamentally change much about the updated processing. My main
> concern was if that additional newline was going to make it into the final
> arguments as extra text. This does not seem to be the case on mac or
> ubuntu, so I guess sed must always eat the last newline when piped in this
> manner.
> I think the most important takaway from the 1.9.7 release are the quoting
> of the final eval, the padding the argument before escaping to support
> empty and whitespace, and the newline for the sed input on Solaris.
>
> Not sure if attachments would go through mailing list so I'll just copy and
> paste inline as they are short.
>
> My ant file is test.xml. Used to echo's a bunch of input properties. The
> trailing _ is to delimit the value to make it readable and prevent ant echo
> from trimming the output:
>
> <project default="run">
>     <target name="run">
>         <echo message="hello world"/>
>         <echo message="foo=${foo}_"/>
>         <echo message="bar=${bar}_"/>
>         <echo message="nl=${nl}_"/>
>         <echo message="nlnl=${nlnl}_"/>
>         <echo message="nlnlnl=${nlnlnl}_"/>
>         <echo message="doublespace=${doublespace}_"/>
>         <echo message="end"/>
>     </target>
> </project>
>
> My test.sh passes a variety of characters as the properties to be echoed.
> Includes literals that use an unballanced single-quote, double-quote,
> backtick, dollar, backslash (trailing on value). Also properties with 1, 2,
> and 3 consecutive trailing newline literals to see if they come through
> accurately. The execdebug flag shows each original argument and the
> quoted/escaped form of the argument used within eval.
>
> =========================
> #!/bin/sh
>
> ant >/dev/null || exit 1
>
> # literal newline char
> NL="
> "
>
> ./dist/bin/ant --execdebug \
>   "-Dfoo=dollar\$_backtick\`_single'_double\"_trailingbackslash\\" \
>   "-Dbar=trailingnewline$NL" \
>   "-Dnl=$NL" \
>   "-Dnlnl=$NL$NL" \
>   "-Dnlnlnl=$NL$NL$NL" \
>   "-Ddoublespace=  " \
>   "-Dx=y" \
>   "-f" "test.xml"
> =========================
>
> Expected output is:
>
> Buildfile: /home/jwa/Developer/projects/apache/ant/test.xml
>
> run:
>      [echo] hello world
>      [echo] foo=dollar$_backtick`_single'_double"_trailingbackslash\_
>      [echo] bar=trailingnewline
>      [echo] _
>      [echo] nl=
>      [echo] _
>      [echo] nlnl=
>      [echo]
>      [echo] _
>      [echo] nlnlnl=
>      [echo]
>      [echo]
>      [echo] _
>      [echo] doublespace=  _
>      [echo] end
>
>
>
> Regards,
> Jeff Adamson

Yes, that works perfectly! On Solaris 11, with your latest version of
the ant wrapper. When I run your test.sh, with the test.xml, I get
exactly the correct output.

However, with esc_tool=awk it fails. Don't know why yet, but the first
property makes it fail already:

[[
bash-4.1> ./ant.new
"-Dfoo=dollar\$_backtick\`_single'_double\"_trailingbackslash\\" -f
test.xml
Buildfile: build.xml does not exist!
Build failed
]]

With -version there is no problem, and running with '-f test.xml'
without properties also works (and fwiw, "-Ddoublespace=  " also
works).

-- 
Johan

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


Mime
View raw message