Hello,
On Wed, Feb 07, 2024 at 07:07:05 CET, Nobody III wrote:
I remember this issue years ago. Basically, the libc read()/write() functions didn't loop until they finished reading the number of bytes specified. While that behavior may technically meet POSIX standards, it isn't standard behavior. Incomplete reads and writes normally only happen with special files, e.g. pipes and sockets. I don't remember what changes were merged, but it sounds like the solution was only partial. There should be a closed GitHub issue about this.
I do not know which "issue" you are referring to but I'm quite aware that we had repeating discussions about "partial reads". I see words above as your "opinion" about the matter and in no way "standard". POSIX and also the ISO C standard are quite explicit about the problematic nature of read() returning a short count in some cases. Both standards leave it to the programmer to cope with these situations and additionally provide a tool for the lazy - fread() [1]. So, if you don't want to treat short/partial reads in your code, just use fread(), but never spread misleading opinions as universal truth.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/ "Upon successful completion, fread() shall return the number of elements successfully read which is less than nitems only if a read error or end-of-file is encountered."
Regards