Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Sep 2017 11:26:03 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 221976] tail(1) can report an incorrect error if stdout becomes a broken pipe
Message-ID:  <bug-221976-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221976

            Bug ID: 221976
           Summary: tail(1) can report an incorrect error if stdout
                    becomes a broken pipe
           Product: Base System
           Version: 10.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: martin@lispworks.com

Created attachment 185973
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D185973&action=
=3Dedit
Patch to avoid calling oerr if there is no errno set.

If stdout becomes a broken pipe while tail(1) is writing to it, then an
incorrect error message can be displayed.  E.g.

$ seq -f '%128g' 1 1000 > /tmp/ints
$ tail -n 856 /tmp/ints | awk '{ exit }'
tail: stdout: No such file or directory
$=20

The problem is that WR in src/usr.bin/tail/extern.h can call oerr() if write
returned a non negative value indicating a partial write, in which case err=
no
is not set.

The attached patch fixes the test case.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221976-8>