From ba00d721f495a6b132b4565e846c820ebf3d4cfa Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Thu, 19 Jun 2025 15:07:58 -0700 Subject: [PATCH] Correct statvfs call to statfs This was missed in the Rust port - C++ had statfs for MNT_LOCAL and not statvfs. The effect of this is that fish never thought its filesystem was local on macOS or BSDs (Linux was OK). This caused history race tests to fail, and also could in rare cases result in history items being dropped with multiple concurrent sessions. This fixes the history race tests under macOS and FreeBSD - we weren't locking because we thought the history was a remote file. --- src/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/path.rs b/src/path.rs index e41762add..210c7ffe5 100644 --- a/src/path.rs +++ b/src/path.rs @@ -710,14 +710,14 @@ pub fn path_remoteness(path: &wstr) -> DirRemoteness { let local_flag = ST_LOCAL() | MNT_LOCAL(); if local_flag != 0 { let mut buf = MaybeUninit::uninit(); - if unsafe { libc::statvfs(narrow.as_ptr(), buf.as_mut_ptr()) } < 0 { + if unsafe { libc::statfs(narrow.as_ptr(), buf.as_mut_ptr()) } < 0 { return DirRemoteness::unknown; } let buf = unsafe { buf.assume_init() }; // statfs::f_flag is hard-coded as 64-bits on 32/64-bit FreeBSD but it's a (4-byte) // long on 32-bit NetBSD.. and always 4-bytes on macOS (even on 64-bit builds). #[allow(clippy::useless_conversion)] - return if u64::from(buf.f_flag) & local_flag != 0 { + return if u64::from(buf.f_flags) & local_flag != 0 { DirRemoteness::local } else { DirRemoteness::remote