bug-autoconf
[Top][All Lists]
Advanced

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

Re: noisy gnulib-tool on IRIX


From: Eric Blake
Subject: Re: noisy gnulib-tool on IRIX
Date: Wed, 08 Sep 2010 10:18:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

[dropping bug-gnulib]

On 09/07/2010 11:38 PM, 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 from passing in).

Ah, but autoconf is already tying up other fd's for things like the log, so reusing fd 5 at script startup before the log is active won't put any additional pressure on the user.

With modern shells, it should work just as well to
   { command; } 2>/dev/null

except of course, really old shells will fork a subshell in order to
execute redirected compound commands, so unless we have some indication
that this was fixed before some other feature we rely on was fixed  ;-)

In this case, I'm not worried if an old shell forks. Rather, I'm trying to optimize things so that bash can start with fewer forks, making the startup experience slightly faster, especially for platforms like cygwin.

we might need a test for that.

That's for sure. And I still plan to do a sampling of various shells to confirm whether { command; } 2>/dev/null is sufficient at avoiding output, regardless of whether it forks on older shells, as it looks cleaner than using exec to fiddle around with fds.

I expect that some shells try to optimize (command) 2>/dev/null by not
always executing command in a subshell (that would explain some of the
bugs old dash had), but I don't know how common that is.  builtin vs.
external command are a potential difference, too, also for old shell
behavior.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

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