I have a file on Windows that has is 9512067072 bytes in size.
GetFileInformationByHandleEx also returns 9512067072 bytes in AllocationSize, however file.metadata()?.len() returns size of the file on disk, which is a bit smaller for some reason, 9512064576 to be precise, which results in file.set_len() call, specifically another SetFileInformationByHandle call with EndOfFile: len: https://github.com/rust-lang/rust/blob/1547c076bfec8abb819d6a81e1e4095d267bd5b4/library/std/src/sys/pal/windows/fs.rs#L350-L353
It would have been all fine, but that triggers one of the numerous Windows bugs. So I'm wondering why is that file.set_len() call needed?
I have a file on Windows that has is 9512067072 bytes in size.
GetFileInformationByHandleExalso returns 9512067072 bytes inAllocationSize, howeverfile.metadata()?.len()returns size of the file on disk, which is a bit smaller for some reason, 9512064576 to be precise, which results infile.set_len()call, specifically anotherSetFileInformationByHandlecall withEndOfFile: len: https://github.com/rust-lang/rust/blob/1547c076bfec8abb819d6a81e1e4095d267bd5b4/library/std/src/sys/pal/windows/fs.rs#L350-L353It would have been all fine, but that triggers one of the numerous Windows bugs. So I'm wondering why is that
file.set_len()call needed?