Possible bug in tail(1)

list at museum.rain.com list at museum.rain.com
Wed Sep 27 19:58:40 UTC 2017


Is it reasonable to expect that tail -r is reversable?  That is, should:

tail -r foo | tail -r

produce the same output as:

cat foo

for all text files foo?

The script below creates a file foo for which the above does not
hold.

This seems to be a somewhat recent bug.  This vintage of 10.2 passes,
as do all ancient versions I can lay hands on (4.8, 9.3):

FreeBSD hostname.example.org 10.2-STABLE FreeBSD 10.2-STABLE #1 r290210: Fri Oct 30 16:36:14 PDT 2015     root at hostname.example.org:/usr/obj/usr/src/sys/GENERIC  amd64

This 10.3 fails:

FreeBSD hostname.example.org 10.3-STABLE FreeBSD 10.3-STABLE #0 r318965: Fri May 26 13:47:47 PDT 2017     root at hostname.example.org:/usr/obj/usr/src/sys/GENERIC  amd64

This 11.1 also fails:

FreeBSD hostname.example.org 11.1-STABLE FreeBSD 11.1-STABLE #0 r321596: Wed Jul 26 18:21:47 PDT 2017     root at hostname.example.org:/usr/obj/usr/src/sys/GENERIC  amd64

Thank you for looking into this.  Apologies in advance for any
unreasonable expectations on my part.

Regards,

Jim



#!/usr/bin/env bash

cat << EOF > foo
1
2
3

EOF

echo "--"
cat foo
echo "--"
tail -r foo
echo "--"
tail -r foo | tail -r
echo "--"



More information about the freebsd-questions mailing list