diff --git a/file_system.go b/file_system.go index 1cddaad..a0253ad 100644 --- a/file_system.go +++ b/file_system.go @@ -244,7 +244,9 @@ type FileSystem interface { // // Note that one potentially significant case where this is *not* called is // munmap(2). (Cf. http://goo.gl/7n1r9X, fuse-devel mailing list thread from - // Han-Wen Nienhuys on 2014-10-08.) + // Han-Wen Nienhuys on 2014-10-08.) Even if users close(2) after writing to + // an mmap'd file, on OS X the contents are not immediately flushed (cf. + // https://github.com/osxfuse/osxfuse/issues/202). // // Because of cases like dup2(2), calls to FlushFile are not necessarily one // to one with calls to OpenFile. They should not be used for reference diff --git a/samples/flushfs/flush_fs_test.go b/samples/flushfs/flush_fs_test.go index 7cd3b2f..2421ede 100644 --- a/samples/flushfs/flush_fs_test.go +++ b/samples/flushfs/flush_fs_test.go @@ -614,13 +614,19 @@ func (t *FlushFSTest) Mmap_MunmapBeforeClose() { ExpectThat(t.getFlushes(), ElementsAre()) ExpectThat(t.getFsyncs(), ElementsAre()) - // Close the file. We should see a flush. + // Close the file. We should see a flush. On Darwin, this will contain out of + // date contents (cf. https://github.com/osxfuse/osxfuse/issues/202). err = t.f1.Close() t.f1 = nil AssertEq(nil, err) - AssertThat(t.getFlushes(), ElementsAre("paco")) - AssertThat(t.getFsyncs(), ElementsAre()) + if runtime.GOOS == "darwin" { + ExpectThat(t.getFlushes(), ElementsAre("taco")) + ExpectThat(t.getFsyncs(), ElementsAre()) + } else { + ExpectThat(t.getFlushes(), ElementsAre("paco")) + ExpectThat(t.getFsyncs(), ElementsAre()) + } } func (t *FlushFSTest) Mmap_CloseBeforeMunmap() {