Stefan Bodewig,
  I made a new pull request based on the ongoing work.

What do you think and can we get some users to test behaviors on a variety
of platforms?

Jeff Adamson

From:   Jeff Adamson/Cleveland/IBM
Date:   10/11/2016 11:51 AM
Subject:        ant wrapper script testing

I have been doing some work on trying to correct errors in the ant shell
script with how special characters and whitespace and handled in arguments.

I have a scratch branch in github. I do forced pushes as I clean it up and
try new things, so beware forking.

I do trials by running a script
      ./bin/ant --execdebug \
      "-Dfoo=dollar\$_backtick\`_single'_double\"\"_trailingbackslash\\" \
      " \
      " \
      "-Ddoublespace= " \
      "-Dx=y" \
      "-f" "test.xml"

where test.xml is simply
      <project default="run">
      <target name="run">
      <echo message="hello world"/>
      <echo message="foo=${foo}_"/>
      <echo message="bar=${bar}_"/>
      <echo message="newline=${newline}_"/>
      <echo message="doublespace=${doublespace}_"/>
      <echo message="end"/>

The trailing _ characters are so that echo task does not trim the output
for trailing whitespace scenarios.

The only solution I have found to date that avoids all behavior quirks such
as echo, sed, awk, and whitespace handling is a bashism/ksh/zsh-ism. So
that does not work for ubuntu's /bin/sh. I have not figured out a universal
correct script for dash (ubuntu) yet.
It may be worth detecting those shells to leverage that when we can.

I have run the script with bash, ksh, zsh, and dash under Ubuntu and Mac.
Csh and tcsh do not seem to work (do we expect them to?)
I do not have an HP-UX or Solaris setup yet (though there are vbox images
for Solaris).

I may not have much time for more testing today, but would appreciate any
1) from people with Solaris and HP-UX and AIX
2) thoughts on introducing shell detection and bashisms into the script
3) how to do a clean string substitution or sed/awk based replacement that
doesn't munge newline and trailing spaces
4) anything else that appears fishy in the test cases

Jeff Adamson

Reply via email to