Roberto Nibali <address@hidden> wrote:
...
> If I may have your attention just for another issue while discussing tail. We
> were negatively surprised when realising that someone at some point removed
> the
> fflush() in tail. This causes tail to behave differently than it use to IMHO
> for
> the last 10 years and I'd like to propose following patch to address this
> issue:
>
> --- coreutils-5.2.1-uclibc/src/tail.c-orig 2004-01-21 15:27:02.000000000
> -0
> 700
> +++ coreutils-5.2.1-uclibc/src/tail.c 2004-12-09 02:46:37.000000000 -0700
> @@ -325,6 +325,7 @@
> assert (fd == STDOUT_FILENO);
> if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) == 0)
> error (EXIT_FAILURE, errno, _("write error"));
> + else fflush(stdout);
> }
Thanks for the suggestion, but what exactly is the problem?
There is already code to call fflush just before sleeping in tail_forever.
Is there some case in which that logic doesn't work?
It's better not to flush for every single xwrite (line of output),
since that would make tail a lot less efficient even when
not using the -f option.
Oh. I see that this has been fixed since 5.2.1.
You can find the development version here:
http://savannah.gnu.org/cvs/?group=coreutils
> If this has come up before, I'd like to get some pointers on why this feature
> was introduced and why there is no backwards compatibility flag or environment
> variable; it certainly isn't specified in either of the POSIX standards to my
> avail. I vaguely remember the same issue a couple of years ago with the tail
> provided by SunOS. Let's not repeat history ;).