ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Adamson" <>
Subject Re: ant wrapper script testing
Date Tue, 25 Oct 2016 17:55:36 GMT

Also glad to know that awk is basically a no-go due to legacy versions.
Suppose we could use `which nawk` to use that if present?

So the trailing newline was a thing that I think was reported against an
earlier iteration. I see no reason we can't change the "padding" to be a "X
\n" value instead of just "X". The trick is to add and strip exactly one
newline from the end so we dont' drop intended newlines from arguments.
Then that should guarantee that sed applies to the whole argument.

I'll see if I can come up with something quickly for that second option.

Jeff Adamson

From:	Johan Corveleyn <>
To:	Ant Developers List <>
Date:	10/25/2016 10:13 AM
Subject:	Re: ant wrapper script testing

On Tue, Oct 25, 2016 at 3:50 PM, Johan Corveleyn <> wrote:
> On Sat, Oct 22, 2016 at 4:11 PM, Stefan Bodewig <>
>> On 2016-10-18, Jeff Adamson wrote:
>>>   I made a new pull request based on the ongoing work.
>> Yes, thanks. I've merged it.
>>> What do you think and can we get some users to test behaviors on a
>>> of platforms?
>> I really hope we can.
> I've tested 1.9.7 with the above change to the ant wrapper script
> (I've copy pasted the "raw" version of the merge to 1.9.x of the above
> pull request) on Solaris 11, but it doesn't work. Not with
> esc_tool=sed and neither with esc_tool=awk. It's easy to test by
> simply executing "ant -version".
> See the output below:
> [[[
> bash-4.1> uname -a
> SunOS hostname-redacted 5.11 11.3 i86pc i386 i86pc
> bash-4.1> ./ -version   ### with esc_tool=sed
> Buildfile: build.xml does not exist!
> Build failed
> bash-4.1> vi   ### change line 25 to esc_tool=awk
> bash-4.1> ./ -version
> awk: syntax error near line 1
> awk: illegal statement near line 1
> awk: syntax error near line 1
> awk: illegal statement near line 1
> awk: syntax error near line 1
> awk: illegal statement near line 1
> awk: syntax error near line 1
> awk: illegal statement near line 1
> Buildfile: build.xml does not exist!
> Build failed
> ]]]
> I don't understand the sed command (I'm not much of a sed expert), but
> I understand why the awk command fails: on Solaris "awk" really is the
> "old awk", without the "new awk" extensions added in 1984 or so. This
> means "gsub" is not available in "awk" on Solaris. To use gsub, you
> have to invoke "nawk" on Solaris.
> So if you want the awk variant to work on Solaris, you either have to
> do it without gsub, or use nawk as executable (but I guess nawk won't
> work on some other unix platforms).
> It would probably be easier to make the sed statement work, but I have
> to experiment a bit with that.

OK, so the problem is that sed on Solaris does not process lines that
don't end with a newline. So if I add a '\n' to the printf statement
that's piped to sed, on line 49, then it works on Solaris. I don't
know if that breaks other platforms of course. See patch below:

---     Tue Oct 25 16:01:51 2016
+++      Tue Oct 25 16:02:19 2016
@@ -46,7 +46,7 @@
     case "$esc_tool" in
         #  mac sed does not support group-0, so pattern uses group-1
-        esc_arg="$(printf '%s' "$esc_arg" | sed -e
+        esc_arg="$(printf '%s\n' "$esc_arg" | sed -e
         esc_arg="$(printf '%s' "$esc_arg" | awk '{ gsub(/\\/,
"\\\\"); print }' )"


Then at least 'ant -version' works on Solaris.


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message