From owner-freebsd-bugs@freebsd.org Thu Sep 28 22:51:36 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B063E0E3EF for ; Thu, 28 Sep 2017 22:51:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 293DE70E55 for ; Thu, 28 Sep 2017 22:51:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v8SMpZGM030867 for ; Thu, 28 Sep 2017 22:51:36 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 222671] tail(1): tail -r fails on certain piped input Date: Thu, 28 Sep 2017 22:51:35 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: freebsd-bugzilla@umpquanet.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 22:51:36 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D222671 Bug ID: 222671 Summary: tail(1): tail -r fails on certain piped input Product: Base System Version: 11.1-STABLE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: freebsd-bugzilla@umpquanet.com I'm not 100% sure of the conditions, but it appears that when: 1) tail -r is reading from a pipe; 2) the first input on the pipe is a newline (first line is blank) tail will reverse the output, except it gets the Nth and (N-1)th output lin= es wrong. It places the first line of input (the newline) on the (N-1)th line= of output, and it place the second line of input on the Nth line of output. $ uname -a FreeBSD g5.umpquanet.com 11.1-STABLE FreeBSD 11.1-STABLE #0 r321722: Sun Ju= l 30 12:07:20 PDT 2017 root@g5.umpquanet.com:/usr/obj/usr/src/sys/G5 amd64 $ printf '\n1\n' 1 $ printf '\n1\n' | tail -r 1 $ printf '\n1\n2\n3\n' 1 2 3 $ printf '\n1\n2\n3\n' | tail -r 3 2 1 $=20 I looked at the GitHub mirror and downloaded a few src tarballs around rece= nt commits to tail. Building tail from: https://github.com/freebsd/freebsd/tree/97a2ca501c7e9f07a80339a88fbb5a46977= ae428 does not manifest the bug. However, tail built from: https://github.com/freebsd/freebsd/tree/2fef72832029bcc228a527dd9c423ba34a7= 490e9 does. IANAE, but it appears the bug may have crept in during: https://reviews.freebsd.org/D9067 HTH, Jim --=20 You are receiving this mail because: You are the assignee for the bug.=