[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Severe performance problem and proposed solution
From: |
Akim Demaille |
Subject: |
Re: Severe performance problem and proposed solution |
Date: |
27 Feb 2002 10:05:42 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
>>>>> "Paul" == Paul Eggert <address@hidden> writes:
>> From: Zack Weinberg <address@hidden> Date: Tue, 26 Feb 2002
>> 17:21:14 -0800
>>
>> In this case, we know that the problem is due to the creation of
>> thousands of temporary files which each subshell invocation creates
>> hard links to. If, I say if, someone can generate a small script
>> that causes the shell to do this, then it could look into /tmp for
>> the scratch files.
Paul> But such a method cannot be reliable in general, since you don't
Paul> know what other processes are doing. Some other process may be
Paul> running 'configure' with a buggy shell at the same time that
Paul> you're running 'configure' with a working shell (not entirely
Paul> implausible, if you're using a parallelized 'make').
And anyway, that's probably not what we want to do. What we want, is
to find a reliable `echo', or any means that would help us remove the
thousands of heredocs we have. Then, as a fallback, just as libtool,
we can have the very top of configure become a proper (= good for us)
echo implemented via here docs.
Therefore the test will be merely checking that the echo, or printf or
whatever, is good enough for us.
This is a bit a libtool:
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
# Discard the --no-reexec flag, and continue.
shift
elif test "X$1" = X--fallback-echo; then
# Avoid inline document here, it may be left over
:
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
# Yippee, $echo works!
:
else
# Restart under the correct shell, and then maybe $echo will work.
exec $SHELL "$0" --no-reexec ${1+"$@"}
fi
if test "X$1" = X--fallback-echo; then
# used as fallback echo
shift
cat <<EOF
$*
EOF
exit 0
fi
(Actually, it's been a while I've been thinking having M4sh equipped
with command substitutes: it would start by a case/esac and provide us
with echo, ln supporting -s, etc.)
Paul> Currently 'configure' switches to Bash if the current shell
Paul> mishandles LINENO and if Bash exists and handles LINENO
Paul> correctly. We could modify things so that instead it switches
Paul> to Bash if the current shell is not Bash and if Bash exists and
Paul> handles LINENO correctly. That would be a bit of a hack, but it
Paul> would do the trick, no?
Sure, but I don't think targeting at Bash only is right :)
Re: Severe performance problem and proposed solution, Zack Weinberg, 2002/02/26