To: vim_dev@googlegroups.com Subject: Patch 8.2.3509 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3509 Problem: Undo file is not synced. (Sami Farin) Solution: Sync the undo file if 'fsync' is set. (Christian Brabandt, closes #8879, closes #8920) Files: runtime/doc/options.txt, src/undo.c *** ../vim-8.2.3508/runtime/doc/options.txt 2021-09-10 15:58:24.442743070 +0100 --- runtime/doc/options.txt 2021-10-14 17:37:39.970189294 +0100 *************** *** 3599,3606 **** systems without an fsync() implementation, this variable is always off. Also see 'swapsync' for controlling fsync() on swap files. ! 'fsync' also applies to |writefile()|, unless a flag is used to ! overrule it. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. --- 3610,3617 ---- systems without an fsync() implementation, this variable is always off. Also see 'swapsync' for controlling fsync() on swap files. ! 'fsync' also applies to |writefile()| (unless a flag is used to ! overrule it) and when writing undo files (see |undo-persistence|). This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. *** ../vim-8.2.3508/src/undo.c 2021-07-27 21:00:39.757712371 +0100 --- src/undo.c 2021-10-14 17:46:13.658523779 +0100 *************** *** 1786,1791 **** --- 1786,1796 ---- write_ok = FALSE; #endif + #if defined(UNIX) && defined(HAVE_FSYNC) + if (p_fs && fflush(fp) == 0 && vim_fsync(fd) != 0) + write_ok = FALSE; + #endif + write_error: fclose(fp); if (!write_ok) *** ../vim-8.2.3508/src/version.c 2021-10-14 16:53:37.417505210 +0100 --- src/version.c 2021-10-14 17:40:33.733106143 +0100 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3509, /**/ -- Although the scythe isn't pre-eminent among the weapons of war, anyone who has been on the wrong end of, say, a peasants' revolt will know that in skilled hands it is fearsome. -- (Terry Pratchett, Mort) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///