Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2019 02:51:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 241559] cat(1) endless loop when writing to special device file
Message-ID:  <bug-241559-227-2QfEGgm9nC@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-241559-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-241559-227@https.bugs.freebsd.org/bugzilla/>

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

--- Comment #2 from sigsys@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 wr=
ote
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, b=
ut
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 t=
he
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 align=
ed
I/O.

--=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-241559-227-2QfEGgm9nC>