[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix AT_SETUP's sh-escaping

From: Stepan Kasal
Subject: Re: fix AT_SETUP's sh-escaping
Date: Wed, 25 Oct 2006 17:18:12 +0200
User-agent: Mutt/

Hello Joel,
  I'm sorry that I haven't looked at your patch earlier.

On Wed, Oct 25, 2006 at 04:20:40AM -0400, Joel E. Denny wrote:
> It seems I was underquoting the argument to AS_ESCAPE.  Or perhaps 
> AS_ESCAPE is underquoting its return.  That is, I'm not sure why the 
> return of AS_ESCAPE should ever be m4 expanded.

I think this is just an extension of the general rule that the return
value of every builtin is expanded again.

I looked at your patch and observed that you are overquoting.

As a general rule, if you write
        MACRO1([something with MACRO2])

then MACRO2 will gen expanded.  You have to quote twice if you want
to preserve the literal string:
        MACRO1([[something with MACRO2]])

And the same rule aplies to AT_SETUP.  I think that your previous
patch has broken this.

Yes, I should test this, and then write a test case.
But writing autotest tests which test autotest is still too deep
magic for me, I'll try later...

IOW, you are overquoting in certain situations.  I think something
like the patch attached to this mail might be better.

A note:
To do the shell escaping right, we should first expand the parameter,
then process it by AS_ESCAPE.  IOW, we need something like
Unfortunately, this would swallow all whitespace after commas in the
text.  And this cannot be fixed with current m4.
So we are just escaping _before_ the expansion, which works only
because people are not using m4 macros here...

A possible solution to this problem might be to put the contents of
AT_help_all to a here document instead of a variable.

Perhaps we could use something like

at_help_all=`cat <<\_ATEOF

and then something like

    at_desc_fmt=`echo "$at_help_all" |
      awk -F';' '$ 1 == '$at_group' { printf "%s\n%-45s\n", $ 3, $ 3 }'`
    at_desc=`echo "$at_desc_fmt" | sed 1q`
    at_desc_fmt=`echo "$at_desc_fmt" | sed '1d;2q'`
    $at_quiet $ECHO_N "m4_format([%3d:],AT_ordinal) $at_desc_fmt$ECHO_C"

and avoid AS_ESCAPE at all.

Would this be portable?
If yes, I might try to build an alternate patch around this idea.

Well, this all looks too tricky to be accepted before 2.61 is out.
But it's Paul's opinion which really matters here.

Have a nice day,
        Stepan Kasal

Attachment: autoconf-20061025-at-help-2.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]