Ralf Wildenhues wrote:
> > (hmm, maybe autoconf should use that trick to reduce
> > forking at m4sh startup).
>
> exec 3>&2 2>/dev/null; command; exec 2>&3 3>&-
>
> has the advantage of not forking, the disadvantage of using another file
> descriptor (which we should probably disallow the user
Eric Blake wrote:
> here's the full
> trace, showing that /bin/sh is ultimately rejected and the script rerun
> under ksh for IRIX.
Thanks. And we know that ksh has a working 'alias' command, so that
gnulib-tool ends up getting a working 'echo' command in that shell.
Bruno
On 09/08/2010 02:44 AM, Bruno Haible wrote:
Hi Eric,
hence the common idiom of first checking if alias/unalias exist using
a subshell check, and if so then using them in the parent shell.
Ah, I didn't think of this trick. But as you noticed, the trick I've found
is more efficient, so I'll use
Hi Eric,
> hence the common idiom of first checking if alias/unalias exist using
> a subshell check, and if so then using them in the parent shell.
Ah, I didn't think of this trick. But as you noticed, the trick I've found
is more efficient, so I'll use it.
> $ /bin/sh -c 'alias 2>/dev/null'
> a
* Eric Blake wrote on Wed, Sep 08, 2010 at 03:12:48AM CEST:
> $ /bin/sh -c 'alias 2>/dev/null'
> alias: Not found
> $ /bin/sh -c '(alias) 2>/dev/null'
> $ /bin/sh -c 'exec 3>&2; exec 2>/dev/null; unalias echo; exec 2>&3;
> exec 3>&-'
> $
>
> the indirect redirection of stderr prior to attempting t
[adding bug-autoconf for a potential optimization]
On 09/07/2010 06:14 PM, Bruno Haible wrote:
Eric Blake wrote:
$ ./gnulib-tool --help 2>&1 | head -n3
alias: Not found
unalias: Not found
Usage: gnulib-tool --list
What happens if you replace the command
unalias echo 2>/dev/null
The poin
Eric Blake wrote:
> $ ./gnulib-tool --help 2>&1 | head -n3
> alias: Not found
> unalias: Not found
> Usage: gnulib-tool --list
What happens if you replace the command
unalias echo 2>/dev/null
with
exec 3>&2
exec 2>/dev/null
unalias echo
exec 2>&3
exec 3>&-
?
Bruno
$ ./gnulib-tool --help 2>&1 | head -n3
alias: Not found
unalias: Not found
Usage: gnulib-tool --list
Using a more detailed trace, I see:
# Because of this, we have to play strange tricks with have_echo, to ensure
# that the top-level statement containing the test starts after the 'alias'
# comm