autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] More changes to the better-shell test


From: Eric Blake
Subject: Re: [PATCH] More changes to the better-shell test
Date: Thu, 30 Oct 2008 06:33:12 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paolo Bonzini on 10/30/2008 3:27 AM:
> 
> 1) avoiding a walk of the entire PATH is one of the first shells passes
> the test (patches 1-2);
> 
> 2) not running the suggested tests for $SHELL in case we reach that
> point (patch 2);

I see you already committed this, but...

> 
> In addition, I noticed that _AS_CR_PREPARE is useless in most scripts.
> I checked that Libtool does not use the as_cr_* variables that it sets,
> either.

Actually, it is NOT useless.  _AS_LINENO_PREPARE uses $as_cr_alnum (which
means that any script that does AS_LINENO_PREPARE or AS_PREPARE needs
_AS_CR_PREPARE, in order to work on hosts with broken LINENO).  Autoconf
scripts that do anything like AC_CHECK_HEADERS or AC_DEFINE also use
various $as_cr_* to form the runtime as_tr_* sed expressions needed to
normalize arbitrary strings into shell/preprocessor names.  But all of
these features independently AS_REQUIRE([_AS_CR_PREPARE]), so we are
merely lowering the point at which it is emitted (in particular,
_AS_SHELL_SANITIZE does _not_ use it).

> 
> I checked that "break N" was in the original Bourne-shell distributed at
> http://www.in-ulm.de/~mascheck/bourne/ (that's more or less the
> 30-year-old v7 shell)

Yes, the manual already documents this, and we already use it elsewhere.

>
> -# _AS_PATH_WALK([PATH = $PATH], BODY)
> -# -----------------------------------
> -# Walk through PATH running BODY for each `as_dir'.
> +# _AS_PATH_WALK([PATH = $PATH], BODY, [IF-NOT-FOUND])
> +# ---------------------------------------------------
> +# Walk through PATH running BODY for each `as_dir'.  If BODY never does a
> +# `break', evaluate IF-NOT-FOUND.

Nice.

>      [],
> -    [as_candidate_shells=
> -    _AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
> +    [_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],

Bingo - I can see the savings already.  $as_candidate_shells is quite a
large variable, and appending all those shells (and walking all those
directories to find which shells to append) is expensive if a candidate
near the beginning passes.

> +       esac],
> +      [AS_IF([{ test -f "$SHELL" || test -f "$SHELL.exe"; } &&
> +           _AS_RUN(["$as_required"], ["$SHELL"])],
> +          [CONFIG_SHELL=$SHELL as_have_required=yes])])

No checking for suggested features on $SHELL?  On the other hand, that
makes sense; $SHELL is our last-ditch attempt, so it either passes
required tests or the user is hosed, no need worrying about suggested tests.

The only change that we need is that you have broken config.status and
other generated scripts - by deleting _AS_CR_PREPARE from
_AS_SHELL_SANITIZE without adding it to _AS_PREPARE, you have made it
possible to generate child scripts that use $as_cr_* without initialization.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkJqYgACgkQ84KuGfSFAYApFACgwb/YaEmpe+BwGwsL8vEqdYSb
YZIAn26bg6YCpr6L9946TldsmgKCkCjS
=BWAD
-----END PGP SIGNATURE-----




reply via email to

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