ftruncate() may fail with EISDIR if other process calls open()

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Apr 8 14:13:17 GMT 2025


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.
Thanks,
Corinna


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /