mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 15:01:16 -03:00
Don't use mmap for history files on OpenBSD
OpenBSD's mmap is famously unsychronized with file IO. In theory fsync and msync can be used to synchronize but I was unable to get it to work. Just don't use mmap for history on OpenBSD. This fixes the history merge tests.
This commit is contained in:
@@ -1319,7 +1319,15 @@ struct history_t::impl_wrapper_t {
|
||||
void history_impl_t::resolve_pending() { this->has_pending_item = false; }
|
||||
|
||||
bool history_t::chaos_mode = false;
|
||||
|
||||
/* OpenBSD's mmap is not synchronized with other file operations. In particular it appears we may
|
||||
* write() a file, fsync() it, close it, mmap() it, and call msync(), and we still may not see the
|
||||
* newly written data. Just don't try mmap here. */
|
||||
#if defined(__OpenBSD__)
|
||||
bool history_t::never_mmap = true;
|
||||
#else
|
||||
bool history_t::never_mmap = false;
|
||||
#endif
|
||||
|
||||
history_t::history_t(wcstring name) : wrap_(make_unique<impl_wrapper_t>(std::move(name))) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user