diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index 65a6ca93e..6bcafde4b 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -495,6 +495,9 @@ void env_universal_t::initialize_at_path(callback_data_list_t &callbacks, wcstri } void env_universal_t::initialize(callback_data_list_t &callbacks) { + // Set do_flock to false immediately if the default variable path is on a remote filesystem. + // See #7968. + if (path_get_config_is_remote() == 1) do_flock = false; this->initialize_at_path(callbacks, default_vars_path(), true /* migrate legacy */); } diff --git a/src/path.cpp b/src/path.cpp index 963e81d65..59e2abd6d 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -419,6 +419,8 @@ bool path_get_data(wcstring &path) { int path_get_data_is_remote() { return get_data_directory().is_remote; } +int path_get_config_is_remote() { return get_config_directory().is_remote; } + void path_make_canonical(wcstring &path) { // Ignore trailing slashes, unless it's the first character. size_t len = path.size(); diff --git a/src/path.h b/src/path.h index b856753b3..366c1dbbc 100644 --- a/src/path.h +++ b/src/path.h @@ -33,6 +33,9 @@ bool path_get_data(wcstring &path); /// -1 means unknown, 0 means known local, 1 means known remote. int path_get_data_is_remote(); +/// Like path_get_data_is_remote but for config directory. +int path_get_config_is_remote(); + /// Emit any errors if config directories are missing. /// Use the given environment stack to ensure this only occurs once. class env_stack_t;