Skip to content

Commit 42bdaaa

Browse files
committed
mingw: change core.fsyncObjectFiles = 1 by default
From the documentation of said setting: This boolean will enable fsync() when writing object files. This is a total waste of time and effort on a filesystem that orders data writes properly, but can be useful for filesystems that do not use journalling (traditional UNIX filesystems) or that only journal metadata and not file contents (OS X’s HFS+, or Linux ext3 with "data=writeback"). The most common file system on Windows (NTFS) does not guarantee that order, therefore a sudden loss of power (or any other event causing an unclean shutdown) would cause corrupt files (i.e. files filled with NULs). Therefore we need to change the default. Note that the documentation makes it sound as if this causes really bad performance. In reality, writing loose objects is something that is done only rarely, and only a handful of files at a time. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6e7dc7c commit 42bdaaa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compat/mingw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,7 @@ int msc_startup(int argc, wchar_t **w_argv, wchar_t **w_env)
30343034
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
30353035
#endif
30363036

3037+
fsync_object_files = 1;
30373038
maybe_redirect_std_handles();
30383039

30393040
/* determine size of argv conversion buffer */
@@ -3100,6 +3101,7 @@ void mingw_startup(void)
31003101
wchar_t **wenv, **wargv;
31013102
_startupinfo si;
31023103

3104+
fsync_object_files = 1;
31033105
maybe_redirect_std_handles();
31043106

31053107
/* get wide char arguments and environment */

0 commit comments

Comments
 (0)