]> git.ipfire.org Git - thirdparty/autoconf.git/commit
m4sh: avoid // issues in _AS_PATH_WALK
authorEric Blake <eblake@redhat.com>
Fri, 13 Jul 2012 16:45:32 +0000 (10:45 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 13 Jul 2012 17:33:13 +0000 (11:33 -0600)
commit0eebfff3e04aae651b954cf98b97b5d382f3f230
treee96b40992cd21774a8fd1b10a6e33ec5165ea058
parent7f1e05a5fc721a3bf2a51e0cd09ec5833e877bd1
m4sh: avoid // issues in _AS_PATH_WALK

As reported by Paul Keir on the cygwin lists,
http://cygwin.com/ml/cygwin/2012-07/msg00263.html,
some people like to stick / in their $PATH, and if we then try
to probe $as_dir/progname for existence, we can end up causing
cygwin to have a several-second timeout per //name probe.  It
is better to avoid inserting the extra slash when $as_dir is the
root directory, and simpler to code by always having a trailing
slash present than it is to strip a trailing slash.  Thankfully,
_AS_PATH_WALK is an undocumented interface, and even if someone
was using it in spite of the warnings, their use of $as_dir/foo
will typically only lead to odd-looking /dir//foo probes, with
only the case of / in $PATH causing slowdowns, and only when //
is special.

There was also a minor bug where the if-not-found code of
_AS_PATH_WALK could be executed with $IFS still in the wrong state.

* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Always end as_dir in /.
Avoid wrong IFS during if-not-found.  Minor optimization to avoid
regex.
(_AS_DETECT_BETTER_SHELL, _AS_SHELL_SANITIZE): Update clients.
* lib/autotest/general.m4 (_AT_FINISH): Likewise.
* lib/autoconf/programs.m4 (_AC_CHECK_PROG, _AC_PATH_PROG)
(_AC_PATH_PROGS_FEATURE_CHECK, _AC_PATH_PROG_FLAVOR_GNU): Likewise.
lib/autoconf/programs.m4
lib/autotest/general.m4
lib/m4sugar/m4sh.m4