bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] bootstrap: take advantage of POSIX shell features


From: Jim Meyering
Subject: Re: [PATCH] bootstrap: take advantage of POSIX shell features
Date: Sun, 13 May 2012 10:31:35 +0200

Stefano Lattarini wrote:

> The 'bootstrap' script offered by Gnulib script already uses POSIX
> shell features (like $((...)) arithmetic expansions) that are not
> supported by legacy Bourne shells like Solaris 10 /bin/sh.  This
> means that bootstrap must already be run using a proper POSIX shell,
> which will thus provide more features, like ${var#pattern} parameter
> expansion or inversion of a command exit status with '!'.  We can
> thus use these features to improve the clarity and the performances
> of the bootstrap script.
>
> * bootstrap: Prefer xpg4 parameter expansions over use of sed/expr
> plus command substitutions, to save some forks.  Since we are at it,
> prefer the POSIX $(...) form of command substitution, rather than
> the legacy form `...` (since the former is visually clearer and
> interacts better with quoting), and prefer "if ! CMD; then ACTION"
> over the idiom "if CMD; then :; else ACTION" (which was required by
> legacy Bourne shells not supporting '!').
...
> diff --git a/build-aux/bootstrap b/build-aux/bootstrap
...
> @@ -442,7 +442,7 @@ check_versions() {
>      # "GNU automake-ng") when asked their version.
>      case $app in
>        automake-ng|aclocal-ng)
> -        app=`echo "$app" | sed 's/-ng$//'`
> +        app=${appo%-ng}
>          ($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
>            echo "$me: Error: '$app' not found or not from Automake-NG" >&2
>            ret=1

s/appo/app/

It looks fine, modulo that typo.
No need to resend.  I'll push it later today or tomorrow.

Thanks for the modernization.



reply via email to

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