Apply Johannes' patch.

I goofed this up.
This commit is contained in:
Aaron Gyes 2021-12-11 10:48:23 -08:00
parent 3b7994df52
commit ccf0b69c3d
4 changed files with 10 additions and 9 deletions

View file

@ -501,7 +501,7 @@ 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()) do_flock = false;
if (path_get_config_is_remote() == maybe_t<bool>{true}) do_flock = false;
this->initialize_at_path(callbacks, default_vars_path(), true /* migrate legacy */);
}

View file

@ -380,7 +380,7 @@ bool history_impl_t::maybe_lock_file(int fd, int lock_type) {
// is on a remote filesystem.
if (abandoned_locking) return false;
if (history_t::chaos_mode) return false;
if (!path_get_data_is_remote()) return false;
if (path_get_data_is_remote() == maybe_t<bool>{true}) return false;
double start_time = timef();
int retval = flock(fd, lock_type);

View file

@ -23,8 +23,8 @@ static maybe_t<size_t> offset_of_next_item_fish_1_x(const char *begin, size_t mm
static bool should_mmap() {
if (history_t::never_mmap) return false;
// mmap only if we are known not-remote (return is 0).
return path_get_data_is_remote() == 0;
// mmap only if we are known not-remote.
return path_get_data_is_remote() == maybe_t<bool>{false};
}
// Read up to len bytes from fd into address, zeroing the rest.

View file

@ -336,9 +336,10 @@ namespace {
/// The following type wraps up a user's "base" directories, corresponding (conceptually if not
/// actually) to XDG spec.
struct base_directory_t {
wcstring path{}; /// the path where we attempted to create the directory.
maybe_t<bool> is_remote{none};/// 1 if the directory is remote (e.g. NFS), 0 if local, -1 if unknown.
int err{0}; /// the error code if creating the directory failed, or 0 on success.
wcstring path{}; /// the path where we attempted to create the directory.
maybe_t<bool> is_remote{
none()}; /// true if the directory is remote (e.g. NFS), false if local, none if unknown.
int err{0}; /// the error code if creating the directory failed, or 0 on success.
bool success() const { return err == 0; }
bool used_xdg{false}; /// whether an XDG variable was used in resolving the directory.
};
@ -394,7 +395,7 @@ void path_emit_config_directory_messages(env_stack_t &vars) {
maybe_issue_path_warning(L"data", _(L"can not save history"), data.used_xdg,
L"XDG_DATA_HOME", data.path, data.err, vars);
}
if (data.is_remote) {
if (data.is_remote == maybe_t<bool>{true}) {
FLOG(path, "data path appears to be on a network volume");
}
@ -404,7 +405,7 @@ void path_emit_config_directory_messages(env_stack_t &vars) {
config.used_xdg, L"XDG_CONFIG_HOME", config.path, config.err,
vars);
}
if (config.is_remote) {
if (config.is_remote == maybe_t<bool>{true}) {
FLOG(path, "config path appears to be on a network volume");
}
}