[Bug 241559] cat(1) endless loop when writing to special device file

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Oct 29 02:51:57 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241559

--- Comment #2 from sigsys at gmail.com ---
Isn't it still less bad with this change?  It still prints an error message if
it gets a write returning 0.  That way you know it had to stop before it wrote
everything.

>From what I found, POSIX says that write() must never return 0 (and that
historically that's something that could happen with non-blocking writes, but
now it must return an EWOUDLBLOCK error instead).  But special files are
special and it's undefined there.

Are you saying that cat could get a write returning 0 *before* it reaches the
end of the disk, depending on how the I/O is aligned?  And that continuing to
try to write could get more data on the disk (even if it'll keep trying to
write forever at the end)?  Checking for a write of 0 seems to be how dd
detects the end of the disk, but then again it is being careful to do aligned
I/O.

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


More information about the freebsd-bugs mailing list