Date: Wed, 06 May 2026 16:30:33 +0000 From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Aaron LI <aly@aaronly.me> Subject: git: c4be32aabf91 - releng/15.1 - tail(1): Fix -r (reverse) to work on pseudo filesystems Message-ID: <69fb6ca9.26a2d.2057fe86@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/15.1 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=c4be32aabf91ec74d95296a3455bb7ed05b50ff5 commit c4be32aabf91ec74d95296a3455bb7ed05b50ff5 Author: Aaron LI <aly@aaronly.me> AuthorDate: 2026-03-17 04:53:49 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-05-06 16:30:14 +0000 tail(1): Fix -r (reverse) to work on pseudo filesystems Pseudo filesystems (e.g., procfs) advertise a zero file size. Fix reverse() to handle such a case similarly as forward() so that '-r' works on pseudo filesystems. Approved by: re (cperciva) Signed-off-by: Aaron LI <aly@aaronly.me> Reviewed by: pouria, Ricardo Branco <rbranco@suse.de>, des Fixes: 1fb3caee7 ("tail: Do not trust st_size if it equals zero.") Pull-Request: https://github.com/freebsd/freebsd-src/pull/2080 (cherry picked from commit 4feeca3193c316c18472cd40f215446fda3bd739) (cherry picked from commit 771a65210018c68198ea413df10225e87a0ea909) --- usr.bin/tail/reverse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index 1fa8784dec6d..690101c0b803 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -78,7 +78,7 @@ reverse(FILE *fp, const char *fn, enum STYLE style, off_t off, struct stat *sbp) if (style != REVERSE && off == 0) return; - if (S_ISREG(sbp->st_mode)) + if (S_ISREG(sbp->st_mode) && sbp->st_size > 0) r_reg(fp, fn, style, off, sbp); else switch(style) {home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69fb6ca9.26a2d.2057fe86>
