Subject: bug#21309: libtool generates binary data in config.log due to buggy escaping

From: Vincent Lefevre <[email-masked]>
Date: Thu, 20 Aug 2015 03:56:02 +0200

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 <[email-masked]> - 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)