bug-coreutils
[Top][All Lists]
Advanced

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

Re: tail.c: 836: recheck: Assertion `valid_file_spec (f)' failed (linux,


From: Roberto Nibali
Subject: Re: tail.c: 836: recheck: Assertion `valid_file_spec (f)' failed (linux, kernel 2.4.x, coreutils 5.2.1)
Date: Mon, 13 Dec 2004 10:00:08 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Hello,

--- 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);
}

This patch is needed or you need to provide for backwards compatibility.

Thanks for the suggestion, but what exactly is the problem?

The problem is that if you pipe your tail output into other processes (no tty assigned) you do not call fflush(stdout). This behaviour has changed and broke a lot of our scripts on a lot of boxes.

There is already code to call fflush just before sleeping in tail_forever.
Is there some case in which that logic doesn't work?

Here is a use case if that helps:

Terminal (window) 1           Terminal (window) 2
-------------------           -------------------

echo 11111 >> 1.out
echo 22222 >> 2.out
                              tail -f 1.out 2.out
                              ==> 1.out <==
                              11111

                              ==> 2.out <==
                              22222

echo 11111 >> 1.out
                              ==> 1.out <==
                              11111
echo 11111 >> 1.out
                              11111
echo 11111 >> 1.out
                              11111
echo 22222 >> 2.out
                              22222
echo 22222 >> 2.out
                              22222

                              CTRL+C

                              tail -f 1.out 2.out | tee bla
                              ==> 1.out <==
                              11111
                              11111
                              11111
                              11111

                              ==> 2.out <==
                              22222
                              22222
                              22222
echo 11111a >> 1.out
                              ==> 1.out <==         } check remark (1)
                              11111a                } check remark (1)
echo 11111a >> 1.out
                              11111a                } check remark (1)
echo 22222a >> 2.out
                              ==> 2.out <==         } check remark (1)
                              22222a                } check remark (1)

remark (1): This does not happen anymore with a recent version of tail. The fflush(stdout) is not done and thus you won't see the output of the last five lines (omitting empty lines) of terminal 2. Is it clearer now?

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.

Don't tell me you dropped it because of performance issues. This would honestly be a joke, and a bad one to add.

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

Hmmm, has it really? Could you show me the changeset, please?

Thanks a lot for looking into it. It caused a lot of damage on our systems and I'm the one that has to fix the stuff, so I hope you understand if I'm a bit pissed off ;). It's by no means against you development guys.

Best regards,
Roberto Nibali, ratz
--
-------------------------------------------------------------
addr://Rathausgasse 31, CH-5001 Aarau  tel://++41 62 823 9355
http://www.terreactive.com             fax://++41 62 823 9356
-------------------------------------------------------------
terreActive AG                       Wir sichern Ihren Erfolg
-------------------------------------------------------------




reply via email to

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