Bug 2407742

Summary: perl-File-Tail rereads entire file even if file has not been rotated
Product: [Fedora] Fedora EPEL Reporter: Mark Tinberg <mark.tinberg>
Component: perl-File-TailAssignee: Tom "spot" Callaway <spotrh>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: epel9CC: perl-devel, spotrh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch for RPM spec, apply first because init-objects patch changes line numbers none

Description Mark Tinberg 2025-10-30 19:13:18 UTC
Created attachment 2111494 [details]
Patch for RPM spec, apply first because init-objects patch changes line numbers

Description of problem:

A file being tailed which is idle for too long will get re-opened and re-read from the beginning, even if the file has _not_ rotated and the new file handle is the same file as the old one, the reset_tail logic kicks in even though the file hasn't been reset.  The expected behavior is that if we reopen the same file to reset our start position for reading at the same place we left off. I think the bug is in the check for the inode cached in the object against the new file handle when we re-open, this doesn't work as expected because the initial file open doesn't cache the inode in the object, only after one rotation does the inode get added.  If you don't re-open a file because it has activity (resetafter == 100s = interval 10s * adjustafter 10s) at least every 100s then this issue can go unnoticed.

https://stackoverflow.com/questions/78312852/getting-perl-filetail-to-begin-streaming-a-file-towards-the-end

Version-Release number of selected component (if applicable): perl-File-Tail-1.3-24.el9

Additional info:

attached is a patch for the RPM, I needed to re-order with the init-objects patch because that adds lines in Tail.pm file which breaks patch/diff without changing the %_default_patch_fuzz value.

I would have also added this to a fork in src.fedoraproject.org but I haven't used Pagure before and couldn't figure out how to make my fork writable by me.  I have this same patch added to a local fork of this package in our internal Gitlab with Epoch: 1 so as to not conflict with EPEL.