GNU bug report logs -
#21309
libtool should not use the dangerous, undocumented AC_TRY_EVAL macro, currently broken
Previous Next
Reported by: Vincent Lefevre <vincent <at> vinc17.net>
Date: Fri, 21 Aug 2015 01:58:02 UTC
Severity: normal
Done: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21309 in the body.
You can then email your comments to 21309 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-libtool <at> gnu.org
:
bug#21309
; Package
libtool
.
(Fri, 21 Aug 2015 01:58:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Vincent Lefevre <vincent <at> vinc17.net>
:
New bug report received and forwarded. Copy sent to
bug-libtool <at> gnu.org
.
(Fri, 21 Aug 2015 01:58:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I've reported the following bug in the Debian BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=796180
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/^.*[ ]\([ABCDGIRSTW][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="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.
--
Vincent Lefèvre <vincent <at> vinc17.net> - 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 <at> gnu.org
:
bug#21309
; Package
libtool
.
(Mon, 08 Feb 2016 18:00:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 21309 <at> debbugs.gnu.org (full text, mbox):
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 <at> vinc17.net> - 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 <at> gnu.org
:
bug#21309
; Package
libtool
.
(Tue, 02 Oct 2018 09:13:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 21309 <at> debbugs.gnu.org (full text, mbox):
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 <at> vinc17.net> - 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 <at> gnu.org
:
bug#21309
; Package
libtool
.
(Tue, 02 Oct 2018 10:59:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 21309 <at> debbugs.gnu.org (full text, mbox):
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 <at> vinc17.net> - 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)
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 <at> vinc17.net>
to
control <at> debbugs.gnu.org
.
(Tue, 02 Oct 2018 10:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-libtool <at> gnu.org
:
bug#21309
; Package
libtool
.
(Tue, 02 Oct 2018 13:47:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 21309 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2018-10-02 12:58:04 +0200, Vincent Lefevre wrote:
> 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.
I've attached a patch that replaces the AC_TRY_EVAL occurrence that
generated the binary data. This is a patch against the Debian package
(libtool 2.4.6-4). I've tested it with MPFR and it seems to work fine.
The other AC_TRY_EVAL occurrences do not cause any problem here,
but should also be replaced in the future.
For the reference, my Debian bug report (clone of 796180, which is
now about autoconf):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910076
--
Vincent Lefèvre <vincent <at> vinc17.net> - 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)
[libtool-eval-nm.patch (text/plain, attachment)]
Reply sent
to
Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>
:
You have taken responsibility.
(Fri, 18 Oct 2024 14:53:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Vincent Lefevre <vincent <at> vinc17.net>
:
bug acknowledged by developer.
(Fri, 18 Oct 2024 14:53:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 21309-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thank you (again :) for the bug report and patch!
The fix you provided has been applied to the development branch:
https://git.savannah.gnu.org/cgit/libtool.git/commit/?h=development&id=f7d11c71dbf23b6a7bc8a273782d3aa3dab08b23
--
Ileana Dumitrescu
GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354
[OpenPGP_0x6570EA01146F7354.asc (application/pgp-keys, attachment)]
[OpenPGP_signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 16 Nov 2024 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 173 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.