This small patch fixes tail -f to not do an lseek if the input is a fifo. For example: rob@localhost rob $ mkfifo /tmp/test.fifo rob@localhost rob $ tail -f /tmp/test.fifo & rob@localhost rob $ echo bah >> /tmp/test.fifo bah tail: /tmp/test.fifo: file truncated tail: /tmp/test.fifo: cannot seek to offset 0: Illegal seek The patch has been sent upstream but it would be nice if this could be patched in the ebuild until it has been accepted by the coreutils maintainers.
Created attachment 35692 [details, diff] fix lseek on fifo bug
Please hold off on this for a bit. This patch causes high cpu usage. I'll work on a better fix.
Created attachment 35751 [details, diff] improved patch for tail This fixes the CPU issues with the former patch. FIFOs are no longer stat'd in the tail_forever loop. If data is read from one or more FIFOs during a tail_forever loop then all FIFOs are skipped the next time around the loop. This prevents the case where two FIFOs had opposite read_eof flags causing tail to loop forever checking and flipping the flags without sleeping.
upstream have commited a patch that fixes this problem.
upstream still haven't released the flippin thing though. "ported" patch to sys-apps/coreutils is attached. Please commit. You can test by merging the -r4 ebuild and trying: echo foo | tail -f It should not die with an illegal seek error message.
Created attachment 47820 [details, diff] patch to fix tail
will be fixed in 5.2.1-r4, thanks