Re: missing backslash escaping in AC_TRY_EVAL yields binary data in config.log with dash

2018-10-02 Thread Vincent Lefevre
On 2018-10-02 09:31:33 -0400, Nick Bowler wrote:
> Drilling into the Autoconf source, we find that this is intentional:
> 
>   # The AC_TRY_EVAL and AC_TRY_COMMAND macros are dangerous and
>   # undocumented, and should not be used.
>   # They may be removed or their API changed in a future release.
>   # Autoconf itself no longer uses these two macros; they are present
>   # only for backward compatibility with previous versions of Autoconf.
>   # Not every shell command will work due to problems with eval
>   # and quoting, and the rules for exactly what does work are tricky.
>   # Worse, due to double-expansion during evaluation, arbitrary unintended
>   # shell commands could be executed in some situations.
> 
> If libtool is still using this macro, and it is causing problems,
> then this does seem like a bug in libtool.  The solution would seem
> to be for libtool to stop using AC_TRY_EVAL.

This is what I've seen too, but I fear that as long as it is not
removed from autoconf, this will never be done. IMHO, a replacement
should be proposed and these macros should be removed. Or these
macros should be fixed and documented.

In the mean time, I wrote a patch for libtool[*] to replace the
occurrence that was generating binary data.

[*] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21309#19

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Re: missing backslash escaping in AC_TRY_EVAL yields binary data in config.log with dash

2018-10-02 Thread Nick Bowler
On 10/2/18, Vincent Lefevre  wrote:
> I originally reported this bug in libtool:
>
>   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21309
>
> but this actually seems to be a bug in AC_TRY_EVAL (or another macro
> it uses).

AC_TRY_EVAL is not documented in the Autoconf manual.

Drilling into the Autoconf source, we find that this is intentional:

  # The AC_TRY_EVAL and AC_TRY_COMMAND macros are dangerous and
  # undocumented, and should not be used.
  # They may be removed or their API changed in a future release.
  # Autoconf itself no longer uses these two macros; they are present
  # only for backward compatibility with previous versions of Autoconf.
  # Not every shell command will work due to problems with eval
  # and quoting, and the rules for exactly what does work are tricky.
  # Worse, due to double-expansion during evaluation, arbitrary unintended
  # shell commands could be executed in some situations.

If libtool is still using this macro, and it is causing problems,
then this does seem like a bug in libtool.  The solution would seem
to be for libtool to stop using AC_TRY_EVAL.

Cheers,
  Nick



missing backslash escaping in AC_TRY_EVAL yields binary data in config.log with dash

2018-10-02 Thread Vincent Lefevre
I originally reported this bug in libtool:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21309

but this actually seems to be a bug in AC_TRY_EVAL (or another macro
it uses).

Under Debian/unstable, with autoconf 2.69, I get binary data in the
config.log for MPFR due to \1 and \2 in echo strings (POSIX says
"if any of the operands contain a  character, the results
are implementation-defined.", thus dash is not broken here).

When doing "sh -x ./configure" (-x to get a trace), I get:

[...]
+ nlist=conftest.nm
+ eval echo "$as_me":7267: "/usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ 
]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | 
sed '/ __gnu_lto/d' \> conftest.nm"
+ echo configure:7267: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ 
]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | 
sed '/ __gnu_lto/d' \> conftest.nm
[...]

In libtool.m4, this comes from:

nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> 
$nlist) && test -s "$nlist"; then

the buggy output being done by AC_TRY_EVAL.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)