Do not lock the history file on remote filesystems

This avoids using locks for the history file if the file appears to be on
a remote file system, like NFS. This is to avoid hangs if the filesystem
does not support locking.

If locking is not enabled, then in rare cases, history items may be
dropped if multiple sessions try to write to the history file at once.
This is thought to be better than hanging. Hopefully the recent change to
require a trailing newline will avoid propagating partial items.
This commit is contained in:
ridiculousfish
2021-05-09 14:47:10 -07:00
parent d1fd3d5825
commit 1af441b4cc
4 changed files with 54 additions and 38 deletions

View File

@@ -417,6 +417,8 @@ bool path_get_data(wcstring &path) {
return dir.success();
}
int path_get_data_is_remote() { return get_data_directory().is_remote; }
void path_make_canonical(wcstring &path) {
// Ignore trailing slashes, unless it's the first character.
size_t len = path.size();