HDFGroup / hdf5

Official HDF5® Library Repository
https://www.hdfgroup.org/
Other
637 stars 261 forks source link

Segfault when opening unseekable file on Cygwin #4804

Open mattjala opened 2 months ago

mattjala commented 2 months ago

Describe the bug test_unseekable_file() results in a segfault when run on Cygwin.

Expected behavior Opening an unseekable file should fail, or at least not segfault.

Platform (please complete the following information)

Additional context See #4797 for discussion

mattjala commented 2 months ago

This is a result of pwrite returning -1 when trying to write to /dev/null on Cygwin, but not on Linux. Note that despite what the name of the test implies, lseek does not return an error when accesing /dev/null on either Cygwin or Linux - so it should probably be renamed.

The failed assertion can be replicated on Linux by replacing the call to pwrite in H5FD__sec2_write() with a fake failure. I'm still looking into how this results in the specific error within the metadata cache.