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: [email protected]
          Reporter: [email protected]

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.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to