autoconf-patches
[Top][All Lists]
Advanced

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

Re: fewer forks during shell detection


From: Paolo Bonzini
Subject: Re: fewer forks during shell detection
Date: Wed, 29 Oct 2008 08:07:15 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

Eric Blake wrote:
> I'm applying the following patch, which reduces the number of forks needed
> during the better shell search portion of M4sh scripts.
> 
> Meanwhile, are there any shells where a message escapes when attempting to
> redirect stderr of a program that can't be executed?  More to the point,
> is this silent:
> 
> echo 'echo hi' > foo
> chmod a-x foo
> echo '...' | ./foo 2>/dev/null
> 
> or must we use (./foo) in order to squelch messages from some shell in the
>  case where ./foo is not executable or not a valid binary image?  I'm
> asking because _AS_RUN is currently using the subshell, after already
> verifying that 'test -f shell' passes (but doesn't do 'test -x shell'),
> and I'd like to remove the subshell if it is safe.
> 
> Also, we have a regression in _AS_LINENO_PREPARE.  The recent change to
> put the shell detection code into the shell variables
> as_suggested/as_required means hat we are now passing uses of $LINENO
> through eval in order to check whether $LINENO works.

Actually the previous code was also using eval, but not through a variable:

 m4_define([_AS_RUN],
-[m4_ifval([$2],
-[{ $2 <<\_ASEOF
-_AS_BOURNE_COMPATIBLE
-$1
-_ASEOF
-}],
-[(eval "AS_ESCAPE(m4_expand([$1]))")])])
+[m4_ifval([$2], [{ $as_echo "$as_bourne_compatible"$1 | ($2); }],
+               [(eval $1)]) 2>/dev/null])


So it is not a regression at least:

$ cat > foo <<\EOF
eval "echo \$LINENO
echo \$LINENO"
f="echo \$LINENO
echo \$LINENO"
eval "$f"
EOF
$ bash foo
2
3
5
6
$ pdksh foo
0
0
0
0

(Note that bash is wrong too!)

Paolo




reply via email to

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