[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] fflush and redirection
From: |
j . eh |
Subject: |
Re: [bug-gawk] fflush and redirection |
Date: |
Fri, 15 Jul 2011 07:37:58 -0500 |
User-agent: |
Mutt/1.4.2.2i |
On Fri, Jul 15, 2011 at 02:57:14PM +0300, Aharon Robbins wrote:
> Hi. Sorry for the delay in replying. Thanks for the bug report and
> suggested patch. Please try the patch below, instead, which restores the
> code to what it was in 3.1.8. This is probably only the first of the
> bugs where some bit of code got misplaced in translation to the new
> internals.
I am most likely the culprit. I recall relocating big chunks of
code to a different file and then back again. May be some bits
of code got lost during the process. :(
Anyone noticing a big performance issue, specially an increase
in systime, should try this patch. Without it, something
like '{ print > "somefile"}' can run at half speed compared
to gawk-3.1.8.
Thanks.
John
>
> Arnold
>
> diff --git a/builtin.c b/builtin.c
> index 724ea6d..1d841dc 100644
> --- a/builtin.c
> +++ b/builtin.c
> @@ -105,7 +105,7 @@ efwrite(const void *ptr,
> if (fwrite(ptr, size, count, fp) != count)
> goto wrerror;
> if (flush
> - && (output_is_tty
> + && ((fp == stdout && output_is_tty)
> || (rp != NULL && (rp->flag & RED_NOBUF)))) {
> fflush(fp);
> if (ferror(fp))