Eric Blake wrote: > According to Paolo Bonzini on 10/17/2008 6:19 AM: >> That's related to tmp being underquoted, see the following even more >> reduced testcase > >> AS_INIT >> m4_defun([AS_DOIT], [: $1]) >> m4_define([tmp], [AS_TR_SH(foo)]) >> AS_DOIT(tmp) > >> => : # Sed expression to map a string onto a valid variable name. >> as_tr_sh="eval sed 'y%*+%pp%;s%^_$as_cr_alnum%_%g'" > >> foo > > Thanks; that was what I was missing. I'm trying to document and test > AS_VAR, and didn't realize that the temporary variable still needed > quoting until the last minute. It turns out that the m4 temporary > variable created by AS_VAR_PUSHDEF must be expanded only at the outermost > level (diversions only work for outermost expansions; otherwise the text > is picked up by argument collection). AS_VAR patch coming up soon, and > nothing more to see in this thread.
I still cannot understand why the diversion ends up like this though. Here is an even smaller testcase: AS_INIT m4_defun([AS_FROBIT_PREPARE], [frob=1]) m4_defun([AS_FROBIT], [AS_REQUIRE([AS_FROBIT_PREPARE])$1]) m4_defun([AS_DOIT], [: $1]) m4_define([XXFOO], [AS_FROBIT(exit 1)]) AS_DOIT(XXFOO) which gives : frob=1 exit 1 as is, and frob=1 : exit 1 when XXFOO is quoted. So, if this is a bug (and it looks like one, though very minor because proper quoting works around it) we also have a testcase. :-) Paolo