
Russell Coker wrote:
On Tue, 10 Apr 2012, Jason White <jason@jasonjgw.net> wrote:
It is my (perhaps faulty) understanding that most editors omit the fsync() and that the file will only be on your memory stick when you unmount it in the typical case.
open("test", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4 write(4, "test\n\n", 6) = 6 fsync(4) = 0 stat("test", {st_mode=S_IFREG|0644, st_size=6, ...}) = 0 close(4)
I've just run strace on vim and it calls fsync.
If most editors omit the fsync() as you claim then please run strace and find us an example of one - and file a bug report while you are at it. ;)
FYI, execve("/usr/bin/emacs", ["emacs", "-Q", "/tmp/y"], [/* 46 vars */]) = 0 [...] access("/tmp/", W_OK) = 0 lstat64("/tmp/.#y", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0 stat64("/tmp/y", 0xbe9b7c48) = -1 ENOENT (No such file or directory) symlink("twb@elba.12820:1333989873", "/tmp/.#y") = -1 EEXIST (File exists) readlink("/tmp/.#y", "twb@elba.12820:1333989873"..., 100) = 25 open("/tmp/y", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 4 write(4, "fnord.", 6) = 6 fsync(4) = 0 close(4) = 0 stat64("/tmp/y", {st_mode=S_IFREG|0644, st_size=6, ...}) = 0 lstat64("/tmp/.#y", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0 readlink("/tmp/.#y", "twb@elba.12820:1333989873", 100) = 25 unlink("/tmp/.#y") = 0 write(3, "\33[49;1H\33[?25lWrote /tmp/y\33[K\33[2;"..., 50) = 50 lstat64("/tmp/y", {st_mode=S_IFREG|0644, st_size=6, ...}) = 0 [...]