GNU bug report logs - #21309
libtool should not use the dangerous, undocumented AC_TRY_EVAL macro, currently broken

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: libtool; Reported by: Vincent Lefevre <vincent@HIDDEN>; dated Fri, 21 Aug 2015 01:58:02 UTC; Maintainer for libtool is bug-libtool@HIDDEN.
Changed bug title to 'libtool should not use the dangerous, undocumented AC_TRY_EVAL macro, currently broken' from 'libtool generates binary data in config.log due to buggy escaping' Request was from Vincent Lefevre <vincent@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 21309 <at> debbugs.gnu.org:


Received: (at 21309) by debbugs.gnu.org; 2 Oct 2018 10:58:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 02 06:58:08 2018
Received: from localhost ([127.0.0.1]:33834 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g7INU-0006ed-9C
	for submit <at> debbugs.gnu.org; Tue, 02 Oct 2018 06:58:08 -0400
Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:38914)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vincent@HIDDEN>)
 id 1g7INR-0006eQ-RI; Tue, 02 Oct 2018 06:58:06 -0400
Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.91)
 (envelope-from <vincent@HIDDEN>)
 id 1g7INQ-0007dx-Q5; Tue, 02 Oct 2018 12:58:04 +0200
Date: Tue, 2 Oct 2018 12:58:04 +0200
From: Vincent Lefevre <vincent@HIDDEN>
To: 21309 <at> debbugs.gnu.org
Subject: Re: libtool generates binary data in config.log due to buggy escaping
Message-ID: <20181002105804.GB12353@HIDDEN>
References: <20150820015602.GC5882@HIDDEN>
 <20160208164439.GA7769@HIDDEN>
 <20181002091252.GA15886@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20181002091252.GA15886@HIDDEN>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/1.10.1+101 (b181996c) vl-108074 (2018-09-27)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 21309
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

retitle 21309 libtool should not use the dangerous, undocumented AC_TRY_EVAL macro, currently broken
thanks

On 2018-10-02 11:12:52 +0200, Vincent Lefevre wrote:
> In libtool.m4, this corresponds to:
> 
>     nlist=conftest.nm
>     if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
> 
> Thus the problem seems to come from AC_TRY_EVAL, i.e. an autoconf bug.

I've seen in the autoconf source that AC_TRY_EVAL should not be used:

# AC_TRY_EVAL(VARIABLE)
# ---------------------
# Evaluate $VARIABLE, which should be a valid shell command.
# The purpose of this macro is to write "configure:123: command line"
# into config.log for every test run.
#
# 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.

-- 
Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-libtool@HIDDEN:
bug#21309; Package libtool. Full text available.

Message received at 21309 <at> debbugs.gnu.org:


Received: (at 21309) by debbugs.gnu.org; 2 Oct 2018 09:12:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 02 05:12:54 2018
Received: from localhost ([127.0.0.1]:33749 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1g7Gje-0001rj-AY
	for submit <at> debbugs.gnu.org; Tue, 02 Oct 2018 05:12:54 -0400
Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:38532)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vincent@HIDDEN>) id 1g7Gjd-0001rc-98
 for 21309 <at> debbugs.gnu.org; Tue, 02 Oct 2018 05:12:53 -0400
Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.91)
 (envelope-from <vincent@HIDDEN>)
 id 1g7Gjc-0003K1-8n; Tue, 02 Oct 2018 11:12:52 +0200
Date: Tue, 2 Oct 2018 11:12:52 +0200
From: Vincent Lefevre <vincent@HIDDEN>
To: 21309 <at> debbugs.gnu.org
Subject: Re: libtool generates binary data in config.log due to buggy escaping
Message-ID: <20181002091252.GA15886@HIDDEN>
References: <20150820015602.GC5882@HIDDEN>
 <20160208164439.GA7769@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20160208164439.GA7769@HIDDEN>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/1.10.1+101 (b181996c) vl-108074 (2018-09-27)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 21309
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2016-02-08 17:44:39 +0100, Vincent Lefevre wrote:
> I actually get these binary data with dash (when setting
> CONFIG_SHELL=/bin/sh in my environment, where /bin/sh is dash).
> 
> On 2015-08-20 03:56:02 +0200, Vincent Lefevre wrote:
> > The generated "libtool" script contains:
> > 
> > global_symbol_pipe="sed -n -e 's/^.*[    ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[       ][      ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
> > 
> > So, I suppose that the binary data come from the \\1 and \\2.
> 
> The problem is that it yields, for instance:
> 
> + echo configure:10030: /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

More details (with the current MPFR trunk, thus this has changed
a bit):

[...]
+ nlist=conftest.nm
+ eval echo "$as_me":7267: "/usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ ]\([A
BCDGIRSTW][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 corresponds to:

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

Thus the problem seems to come from AC_TRY_EVAL, i.e. an autoconf bug.

According to https://debbugs.gnu.org/Packages.html, autoconf doesn't
use this bug tracker, so that I'm going to report a separate bug for
autoconf.

-- 
Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-libtool@HIDDEN:
bug#21309; Package libtool. Full text available.

Message received at 21309 <at> debbugs.gnu.org:


Received: (at 21309) by debbugs.gnu.org; 8 Feb 2016 17:59:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 08 12:59:17 2016
Received: from localhost ([127.0.0.1]:60281 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1aSq5l-0000Gl-FQ
	for submit <at> debbugs.gnu.org; Mon, 08 Feb 2016 12:59:17 -0500
Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:35288)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <vincent@HIDDEN>) id 1aSq5k-0000Ge-2m
 for 21309 <at> debbugs.gnu.org; Mon, 08 Feb 2016 12:59:16 -0500
Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.86)
 (envelope-from <vincent@HIDDEN>)
 id 1aSovX-000236-EQ; Mon, 08 Feb 2016 17:44:39 +0100
Date: Mon, 8 Feb 2016 17:44:39 +0100
From: Vincent Lefevre <vincent@HIDDEN>
To: 21309 <at> debbugs.gnu.org
Subject: Re: libtool generates binary data in config.log due to buggy escaping
Message-ID: <20160208164439.GA7769@HIDDEN>
References: <20150820015602.GC5882@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20150820015602.GC5882@HIDDEN>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/1.5.24-6554-vl-r83103 (2016-01-26)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 21309
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

I actually get these binary data with dash (when setting
CONFIG_SHELL=/bin/sh in my environment, where /bin/sh is dash).

On 2015-08-20 03:56:02 +0200, Vincent Lefevre wrote:
> The generated "libtool" script contains:
> 
> global_symbol_pipe="sed -n -e 's/^.*[    ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[       ][      ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
> 
> So, I suppose that the binary data come from the \\1 and \\2.

The problem is that it yields, for instance:

+ echo configure:10030: /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

With bash:

$ echo '\1' | hd
00000000  5c 31 0a                                          |\1.|
00000003

With dash:

$ echo '\1' | hd
00000000  01 0a                                             |..|
00000002

POSIX[*] says:

  if any of the operands contain a <backslash> character, the results
  are implementation-defined.

So, the above code is not portable.

[*] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

-- 
Vincent Lefèvre <vincent@HIDDEN> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Information forwarded to bug-libtool@HIDDEN:
bug#21309; Package libtool. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Aug 2015 01:57:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 20 21:57:03 2015
Received: from localhost ([127.0.0.1]:34018 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZSbZn-0006En-5S
	for submit <at> debbugs.gnu.org; Thu, 20 Aug 2015 21:57:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:60376)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <vincent@HIDDEN>) id 1ZSbZl-0006EO-0b
 for submit <at> debbugs.gnu.org; Thu, 20 Aug 2015 21:57:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <vincent@HIDDEN>) id 1ZSbZh-0001re-Hg
 for submit <at> debbugs.gnu.org; Thu, 20 Aug 2015 21:57:00 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:35175)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <vincent@HIDDEN>) id 1ZSbZh-0001rX-7t
 for submit <at> debbugs.gnu.org; Thu, 20 Aug 2015 21:56:57 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54144)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <vincent@HIDDEN>) id 1ZSF5S-0007gR-Ul
 for bug-libtool@HIDDEN; Wed, 19 Aug 2015 21:56:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <vincent@HIDDEN>) id 1ZSF5P-0000T0-Dx
 for bug-libtool@HIDDEN; Wed, 19 Aug 2015 21:56:14 -0400
Received: from ioooi.vinc17.net ([92.243.22.117]:51634)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <vincent@HIDDEN>) id 1ZSF5P-0000PS-8W
 for bug-libtool@HIDDEN; Wed, 19 Aug 2015 21:56:11 -0400
Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128])
 by ioooi.vinc17.net (Postfix) with ESMTPSA id 479E812B;
 Thu, 20 Aug 2015 03:56:02 +0200 (CEST)
Received: by zira.vinc17.org (Postfix, from userid 1000)
 id 19EDDC2000A; Thu, 20 Aug 2015 03:56:02 +0200 (CEST)
Date: Thu, 20 Aug 2015 03:56:02 +0200
From: Vincent Lefevre <vincent@HIDDEN>
To: bug-libtool@HIDDEN
Subject: libtool generates binary data in config.log due to buggy escaping
Message-ID: <20150820015602.GC5882@HIDDEN>
Mail-Followup-To: Vincent Lefevre <vincent@HIDDEN>, bug-libtool@HIDDEN
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/1.5.23-6482-vl-r81226 (2015-08-17)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

I've reported the following bug in the Debian BTS:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D796180

but I can reproduce it with the official libtool 2.4.6.

When I run "./configure" with MPFR, the generated config.log file
contains binary data:

configure:9458: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGI=
RSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/^A ^B ^B/p' | sed =
'/ __gnu_lto/d' \> conftest.nm

where ^A and ^B are the ASCII characters of code 1 and 2 respectively.
Thus, the "file" utility thinks that this is a binary file, so that
"less" + "lesspipe" mangles the file. Rather annoying!

The generated "libtool" script contains:

global_symbol_pipe=3D"sed -n -e 's/^.*[    ]\\([ABCDGIRSTW][ABCDGIRSTW]*\=
\)[       ][      ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '=
/ __gnu_lto/d'"

So, I suppose that the binary data come from the \\1 and \\2.

--=20
Vincent Lef=E8vre <vincent@HIDDEN> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Acknowledgement sent to Vincent Lefevre <vincent@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to bug-libtool@HIDDEN:
bug#21309; Package libtool. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 2 Oct 2018 11:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.