Further expand the list of filesystems considered remote

Incorporate additional file systems from
https://github.com/coreutils/gnulib/blob/master/lib/mountlist.c#L237-L253
by hunting down their magic numbers.

In the future we could consider switching to f_fstypename.
This commit is contained in:
Peter Ammon 2024-11-02 11:54:17 -07:00
parent cfcf415db7
commit 344b072e82
No known key found for this signature in database
2 changed files with 15 additions and 2 deletions

View File

@ -15,6 +15,13 @@
//!
//! 5. The chaos_mode boolean can be set to true to do things like lower buffer sizes which can
//! trigger race conditions. This is useful for testing.
//!
//! Locking on remote filesystems may hang for an unacceptably long time. For that reason, fish
//! does not take locks on the file if it believes the history file is on a remote filesystem,
//! or if the mmap fails with ENODEV, or if the first lock attempt takes excessively long.
//! Eliding locks means that two concurrent shell sessions with a remote history file may, in
//! rare cases with multiple simultaneous shell sessions, lose a history item; this is
//! considered preferable to hanging the the shell waiting for a lock.
use crate::{
common::cstr2wcstring, env::EnvVar, wcstringutil::trim,

View File

@ -699,16 +699,22 @@ fn path_remoteness(path: &wstr) -> DirRemoteness {
// Note that we treat FUSE filesystems as remote, which means we lock less on such filesystems.
// NOTE: The cast is necessary for 32-bit systems because of the 4-byte CIFS_MAGIC_NUMBER
match usize::try_from(buf.f_type).unwrap() {
0x5346414F | // AFS_SUPER_MAGIC - Andrew Fule System
0x5346414F | // AFS_SUPER_MAGIC - Andrew File System
0x6B414653 | // AFS_FS_MAGIC - Kernel AFS and AuriStorFS
0x73757245 | // CODA_SUPER_MAGIC - Coda File System
0x47504653 | // GPFS - General Parallel File System
0x564c | // NCP_SUPER_MAGIC - Novell NetWare
0x6969 | // NFS_SUPER_MAGIC
0x7461636f | // OCFS2_SUPER_MAGIC - Oracle Cluster File System
0x61636673 | // ACFS - Oracle ACFS. Undocumented magic number.
0x517B | // SMB_SUPER_MAGIC
0xFE534D42 | // SMB2_MAGIC_NUMBER
0xFF534D42 | // CIFS_MAGIC_NUMBER
0x01021997 | // V9FS_MAGIC
0x65735546 // FUSE_SUPER_MAGIC
0x19830326 | // fhgfs / BeeGFS. Undocumented magic number.
0x013111A7 | 0x013111A8 | // IBRIX. Undocumented.
0x65735546 | // FUSE_SUPER_MAGIC
0xa501FCF5 // VXFS_SUPER_MAGIC
=> DirRemoteness::remote,
_ => {
DirRemoteness::unknown