libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: [PATCH] bootstrap: adopt autoconf echo normalization code.


From: Gary V. Vaughan
Subject: Re: FYI: [PATCH] bootstrap: adopt autoconf echo normalization code.
Date: Sat, 24 Dec 2011 08:49:20 +0700

Hi Eric,

On 19 Dec 2011, at 20:48, Eric Blake wrote:
> On 12/18/2011 12:46 AM, Gary V. Vaughan wrote:
>> Pushed as obvious.
>> 
>> Dash shipped with Ubutu-11.10 as /bin/sh, among others, still
>> has a crippled echo builtin that mis-handles backslashes.
> 
> That's an unfair characterization.  Rather, dash ships an echo builtin
> that complies with POSIX by default (which mandates backslash
> interpretation), while bash ships an echo builtin that ignores backslash
> by default, but can be made to comply with POSIX via 'shopt -s xpg_echo'.

I wasn't aware of the POSIX distinction, although while dash my be strictly
correct, it does mean that POSIX compliant echo is essentially useless for
bootstrap (and autoconf, and libtool etc etc)... entailing an ugly blob of
code to detect and circumvent any echo implementation that behaves that way.

>> +++ b/build-aux/options-parser
>> @@ -173,6 +173,46 @@ basename='s|^.*/||'
>> nl='
>> '
>> 
>> +# There are still modern systems that have problems with `echo' mis-
>> +# handling backslashes, among others, so make sure $bs_echo is set to a
>> +# command that correctly interprets backslashes.
> 
> Again, a mis-characterization of the problem.

No offense implied or intended by that comment, and I'll be happy to apply
a followup patch if you submit something preferable.

>> +# (this code from Autoconf 2.68)
>> +
>> +# Printing a long string crashes Solaris 7 /usr/bin/printf.
>> +bs_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
>> +bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
>> +bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
>> +# Prefer a ksh shell builtin over an external printf program on Solaris,
>> +# but without wasting forks for bash or zsh.
>> +if test -z "$BASH_VERSION$ZSH_VERSION" \
>> +    && (test "X`print -r -- $bs_echo`" = "X$bs_echo") 2>/dev/null; then
>> +  bs_echo='print -r --'
>> +  bs_echo_n='print -rn --'
> 
> Also, I'm not sure that I like the name $bs_echo - it's not namespace
> clean.  I would have expected something more like $lt_echo.

lt_ is the libtool namespace, and options-parser is a module of bootstrap,
so I used bs_.

After the initial encouragement on the gnulib list, I wrote bootstrap for
gnulib, but it looks like it won't ever make it upstream in its previous
form, so I split it into a reusable options-parser script that provides the
hooks and requires framework and uses it to implement a pluggable shell
script options parser that can be extended by writing a few functions...
and then on top of that my much improved extract-trace script which is a
standalone proof of concept that m4 can be used more easily and profitably
for parsing configure.{ac,in} than ad-hoc sed scripts, and finally with the
saner bootstrap implemented on top of both of those.

When I next have some time to hand-hold the process, I'll make another attempt
at getting gnulib to accept this version of bootstrap, which I hope will prove
a bit easier with the separation into smaller chunks, each useful in its own
right, and then try and get autoreconf and others to adopt the extract-trace
script and/or approach over brittle ad-hoc sed scripts.

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]