Bug 276107

Summary: [patch] tail(1) is not able to operate on files residing in pseudo-filesystems
Product: Base System Reporter: Ricardo Branco <rbranco>
Component: binAssignee: Xin LI <delphij>
Status: Closed FIXED    
Severity: Affects Only Me CC: delphij, freebsd, zarychtam
Priority: ---    
Version: 14.0-STABLE   
Hardware: Any   
OS: Any   
URL: https://github.com/freebsd/freebsd-src/pull/990

Description Ricardo Branco 2024-01-03 20:38:37 UTC
tail(1) is not able to operate on files residing in pseudo-filesystems or others that advertise a zero size.

To reproduce: `tail -1 /compat/linux/proc/mounts` dumps the whole file.

Fix: https://github.com/freebsd/freebsd-src/pull/990
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-01-04 09:01:47 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1fb3caee72241b9b4dacbfb0109c972a86d4401f

commit 1fb3caee72241b9b4dacbfb0109c972a86d4401f
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2024-01-03 20:32:47 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-01-04 09:00:23 +0000

    tail: Do not trust st_size if it equals zero.

    PR:             bin/276107
    MFC after:      1 week

 usr.bin/tail/forward.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 2 Xin LI freebsd_committer freebsd_triage 2024-01-04 09:04:41 UTC
Committed, thanks!
Comment 3 Marek Zarychta 2024-01-05 22:49:44 UTC
Please try instead: cat /compat/linux/proc/mounts | tail -1