ftruncate() may fail with EISDIR if other process calls open()
Christian Franke
Christian.Franke@t-online.de
Tue Apr 8 15:07:47 GMT 2025
Corinna Vinschen via Cygwin wrote:
> On Apr 8 13:50, Corinna Vinschen via Cygwin wrote:
>> On Apr 7 09:59, Christian Franke via Cygwin wrote:
>>> Found because 'stress-ng --fcntl 2 --verify' reports "ftruncate failed,
>>> errno=21":
>> Thanks for the testcase. I know what happens. Stay tuned for a patch.
> Nice problem. That's what happens if you try to do what an OS is doing,
> without actually being an OS, just a user space lib. Theoretically we
> should never cache any file information but always call the matching OS
> functions. Only... this adds quite a few context switches every time
> accessing files. Sigh.
>
> I just pushed 2d81f6ebe3dc ("Cygwin: open: always fix up cached DOS file
> attributes after NtCreateFile").
>
> Try the upcoming cygwin-3.7.0-0.47.g9e6193576f34.
With a local build of 3.7.0-dev-49-g42df80dad079.x86_64, both the
testcase and stress-ng no longer fail.
--
Regards,
Christian
More information about the Cygwin
mailing list