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: Fri, 10 Dec 2004 09:10:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Hello,

Thanks for your time in addressing this.

Thanks for reporting the problem.  Part of the problem is that your
DRDB mounted partition is returning I/O errors on large files for some
reason.

The problem was that I've formated the underlying /dev/md0 instead the /dev/drdb0 device. The problem is that DRDB in my configuration has an internal meta file of 128MB which /dev/md0 knows nothing about. So the superblock structure will let the VFS reuse all inodes of all blocks while DRDB will try to fill up the 128MB for its internal meta data structures. This will eventually cause this mess.

This is not a bug in "tail"; it is a bug or other problem
with your file system.  You can investigate this further by using
"strace tail -f file" and looking at the system calls it executes.

That's what we did and I've also consulted the DRDB-mailinglist for additional help and this is the general conclusion based on the observed behaviour.

But the other problem is a bug in "tail": it should not report
an assertion failure, even if there is an I/O error when reading
its input data.  I installed this patch to CVS coreutils:

2004-12-03  Paul Eggert  <address@hidden>

        * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
        failed.  This works around an assertion failure reported by
        Roberto Nibali in:
        http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html

--- src/tail.c  28 Sep 2004 06:34:22 -0000      1.230
+++ src/tail.c  4 Dec 2004 07:02:35 -0000       1.231
@@ -1317,7 +1317,7 @@ tail_file (struct File_spec *f, uintmax_
             call made the window big enough to exercise the problem.  */
          sleep (1);
 #endif
-         f->errnum = 0;
+         f->errnum = ok - 1;
          if (fstat (fd, &stats) < 0)
            {
              ok = false;

Ok, unfortunately I cannot test this anymore since it was a pilot project setup which is now productive and the internal meta data issue has been resolved. It looks reasonable enough based on your comments in its simplicity.

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

 static void

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

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]