[Bug 221976] tail(1) can report an incorrect error if stdout becomes a broken pipe
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Sep 1 11:26:03 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221976
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 at FreeBSD.org
Reporter: martin at lispworks.com
Created attachment 185973
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=185973&action=edit
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
$
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 errno
is not set.
The attached patch fixes the test case.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list