On 07/06/2012 07:11 AM, Akim Demaille wrote:

> How about this?
> 
> From 96b829fb08217060f20a6a56eddb1a952324fa35 Mon Sep 17 00:00:00 2001
> From: Akim Demaille <[email protected]>
> Date: Fri, 6 Jul 2012 15:01:53 +0200
> Subject: [PATCH] bootstrap: let warn be alike tests/init.sh's warn_
> 
> Reported by Jim Meyering.
> * build-aux/bootstrap (warn): Remove, replaced by...
> (warnf_, warn_): these.
> Adjust callers.
> Shorten messages that no longer fit in 80 columns.

> -warn()
> +# warnf_ FORMAT-STRING ARG1...
> +warnf_ ()
>  {
> -  for i
> -  do
> -    echo "$i"
> -  done | sed -e "s/^/$me: /" >&2

This is broken if you invoke './bootstrap', since then $me contains /
and bootstrap complains:

autoreconf: Leaving directory `.'
sed: -e expression #1, char 7: unknown option to `s'

> +  warnf_format_=$1
> +  shift
> +  printf "$warnf_format_" "$@" | sed "s,^,$me: ," >&2

but this isn't much better, since ',' is still easy enough to put in a
file name.  For this reason, the Autoconf manual recommends using s|||,
not s,,, or s///, when dealing with any expression where a file name
will be substituted in place, since it is less likely to encounter file
names that have shell metacharacters in them.

Can we at least push something that unbreaks bootstrap while deciding on
the best final approach to use?

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to