| Summary: | tail(1) can report an incorrect error if stdout becomes a broken pipe | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | martin | ||||
| Component: | bin | Assignee: | Conrad Meyer <cem> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | CC: | cem | ||||
| Priority: | --- | Keywords: | patch | ||||
| Version: | 10.3-RELEASE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Created attachment 185973 [details] 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.