Bug 57477 - Fix for broken tail -f behaviour when watching fifos
|
Bug#:
57477
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: All
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: base-system@gentoo.org
|
Reported By: tigger@gentoo.org
|
|
Component: Core system
|
|
|
URL:
|
|
Summary: Fix for broken tail -f behaviour when watching fifos
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2004-07-18 06:34 0000
|
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.
Please hold off on this for a bit. This patch causes high cpu usage. I'll work
on a better fix.
Created an attachment (id=35751) [details]
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.
will be fixed in 5.2.1-r4, thanks