[PATCH] tst-fopen-threaded: Only check EOF for failing read
Siddhesh Poyarekar
siddhesh@sourceware.org
Fri Mar 14 15:45:47 GMT 2025
On 2025-03-14 11:29, Florian Weimer wrote:
> * Siddhesh Poyarekar:
>
>>> You don't mention anywhere why you remove the clearerr call? I think
>>> that's necessary because the test assumes that feof is sticky.
>>
>> Would it change the outcome though? If there are multiple failing
>> readers, they would reliably result in the test failing regardless of
>> whether the EOF/error flag is cleared.
>
> I think you get another race if you leave in the clearerr because a
> reader that sees EOF in fread (0 return) might not observe ot in feof
> because it got reverted by a concurrent clearerr (which clears the EOF
> indicator, too).
Indeed, I hadn't noticed that, thanks. I'll enhance the comment block
to add this.
> (By the way, it's not clear from the patch context that ret == 0 is
> correct here, that's because sizeof (read_buffer) is 1 is as well. So
> the short read scenario cannot really happen.)
I'll enhance the comment to describe this too.
Thanks,
Sid
More information about the Libc-alpha
mailing list