> > notice that tail -f works fine when the file is not marked append only...
> > now don't ask me why O_NONBLOCK is denied on append only files... but it 
> > is...
> 
> I take it that there is no bug in the tail program, then.

there is absolutely a bug in the tail program... this was not a problem in 
5.2.1-2.1 because the older version doesn't foolishly try to force 
O_NONBLOCK on a regular file.  the patch below fixes this problem.

append-only files are still readable -- they just can't be written 
anywhere except at the end.

append-only are the ideal log file -- especially if they're being written 
by a non-root user... for example, if a non-root user is compromised they 
still can't modify log files to erase their tracks -- they have to make it 
to root first and remove the append-only attribute.

considering tail -f worked on append-only files prior to 5.93 i consider 
this to be a necessary fix...

-dean

--- coreutils-5.93/src/tail.c.orig      2005-11-02 05:18:47.000000000 -0800
+++ coreutils-5.93/src/tail.c   2005-11-15 17:58:55.852102952 -0800
@@ -1020,7 +1020,8 @@
              int new_flags = old_flags | (blocking ? 0 : O_NONBLOCK);
              if (old_flags < 0
                  || (new_flags != old_flags
-                     && fcntl (fd, F_SETFL, new_flags) == -1))
+                     && fcntl (fd, F_SETFL, new_flags) == -1
+                     && (!S_ISREG(f[i].mode) || errno != EPERM)))
                error (EXIT_FAILURE, errno,
                       _("%s: cannot change nonblocking mode"), name);
              f[i].blocking = blocking;







-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to