The origin parameter to File.seek() should only accept SEEK_STEP, SEEK_CUR or SEEK_END. When a different int is passed, an exception is correctly thrown when compiled with -m32. However, on Windows 10 at least, when compiled with either -m32mscoff or -m64, the process terminates without any message whatsoever.
import std.experimental.all;
void main()
{
auto deleteme = "deleteme";
auto f = File(deleteme, "wb+");
scope(exit) { f.close(); std.file.remove(deleteme); }
f.seek(0, 3); // Should throw.
writeln("Ending gracefully."); // Never seen.
}
Comment #1 by dlang-bot — 2019-04-09T11:22:22Z
@veelo updated dlang/phobos pull request #6948 "WIP Increase type safety of File.seek()" mentioning this issue:
- Special case enforce against issue 19797, documentation.
https://github.com/dlang/phobos/pull/6948
Comment #2 by dlang-bot — 2019-04-14T09:19:24Z
dlang/phobos pull request #6948 "Fix issue 19797 - Ungraceful termination in File.seek() on Windows" was merged into master:
- a2aa3d3590b5c5f06e51dc32bcda16bd44a7982b by Bastiaan Veelo:
Special case enforce against issue 19797, documentation.
https://github.com/dlang/phobos/pull/6948
Comment #3 by dlang-bot — 2019-10-23T01:54:16Z
@Geod24 created dlang/phobos pull request #7244 "Make tests for issue 19797 Windows-only" mentioning this issue:
- Make tests for issue 19797 Windows-only
Value '3' is a valid value on Linux (SEEK_DATA, since 3.18).
Hence, in some cases (depending on FS support / Kernel version),
this test can fails.
https://github.com/dlang/phobos/pull/7244
Comment #4 by robert.schadek — 2024-12-13T19:02:57Z