I use the following software:
W2K, cygwin-1.1.3-1, textutils-2.0.

To spy on log files I run:
tail --retry --follow=name /y/logs/cf.log
where cf.log is a file in a remote file system mounted to directory /y.

Periodically I rename cf.log to something like cf-current-date.log
and when new cf.log appears tail crashes with message
==
assertion "valid_file_spec (f)" failed: file "tail.c", line 700
      0 [sig] tail 1007 stackdump: Dumping stack trace to tail.exe.stackdump
==

I traced tail in gdb and found the following:
when I rename cf.log to cf-yyyy-mm-dd.log and create new cf.log this
new cf.log has the same st_ino and st_dev as old cf.log before
renaming, so tail cannot determine that cf.log is a new file and
the conditional expression in tail.c (line 761) results false
==
  else if (f->ino != new_stats.st_ino || f->dev != new_stats.st_dev)
==
statements from line 787 to 798 do not execute
==
  if (new_file)
    {
      /* Record new file info in f.  */
      f->fd = fd;
      f->size = 0; /* Start at the beginning of the file...  */
      f->dev = new_stats.st_dev;
      f->ino = new_stats.st_ino;
      f->n_unchanged_stats = 0;
      f->n_consecutive_size_changes = 0;
      /* FIXME: check lseek return value  */
      lseek (f->fd, f->size, SEEK_SET);
    }
==
f->errnum becomes 0 and f->fd remains -1 though cf.log was opened
successfully.

In the next call of recheck assertion on line 700 prints an error
message.
==
  assert (valid_file_spec (f));
==

When cf.log places on a local file system tail works correctly.

Igor


Reply via email to