]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsmonitor-settings: NTFS and FAT32 on MacOS are incompatible
authorJeff Hostetler <jeffhost@microsoft.com>
Thu, 26 May 2022 21:47:04 +0000 (21:47 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 May 2022 22:59:26 +0000 (15:59 -0700)
On MacOS mark repos on NTFS or FAT32 volumes as incompatible.

The builtin FSMonitor used Unix domain sockets on MacOS for IPC
with clients.  These sockets are kept in the .git directory.
Unix sockets are not supported by NTFS and FAT32, so the daemon
cannot start up.

Test for this during our compatibility checking so that client
commands do not keep trying to start the daemon.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/fsmonitor/fsm-settings-darwin.c
fsmonitor-settings.c
fsmonitor-settings.h

index fdd762bf79d125d9031c60897c0ee3bcc8c03673..efc732c0f317fc63c75d5878c82695748bcc1aa4 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/mount.h>
 
 /*
- * Remote working directories are problematic for FSMonitor.
+ * [1] Remote working directories are problematic for FSMonitor.
  *
  * The underlying file system on the server machine and/or the remote
  * mount type (NFS, SAMBA, etc.) dictates whether notification events
  *
  * So (for now at least), mark remote working directories as
  * incompatible.
+ *
+ *
+ * [2] FAT32 and NTFS working directories are problematic too.
+ *
+ * The builtin FSMonitor uses a Unix domain socket in the .git
+ * directory for IPC.  These Windows drive formats do not support
+ * Unix domain sockets, so mark them as incompatible for the daemon.
+ *
  */
-static enum fsmonitor_reason check_remote(struct repository *r)
+static enum fsmonitor_reason check_volume(struct repository *r)
 {
        struct statfs fs;
 
@@ -60,6 +68,12 @@ static enum fsmonitor_reason check_remote(struct repository *r)
        if (!(fs.f_flags & MNT_LOCAL))
                return FSMONITOR_REASON_REMOTE;
 
+       if (!strcmp(fs.f_fstypename, "msdos")) /* aka FAT32 */
+               return FSMONITOR_REASON_NOSOCKETS;
+
+       if (!strcmp(fs.f_fstypename, "ntfs"))
+               return FSMONITOR_REASON_NOSOCKETS;
+
        return FSMONITOR_REASON_OK;
 }
 
@@ -67,7 +81,7 @@ enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
 {
        enum fsmonitor_reason reason;
 
-       reason = check_remote(r);
+       reason = check_volume(r);
        if (reason != FSMONITOR_REASON_OK)
                return reason;
 
index d2fb0141f8e7fd0301c63041738531879964c59e..658cb79da0123b900a31b7205582edde196eded7 100644 (file)
@@ -225,6 +225,12 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r,
                            _("virtual repository '%s' is incompatible with fsmonitor"),
                            r->worktree);
                goto done;
+
+       case FSMONITOR_REASON_NOSOCKETS:
+               strbuf_addf(&msg,
+                           _("repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"),
+                           r->worktree);
+               goto done;
        }
 
        BUG("Unhandled case in fsm_settings__get_incompatible_msg: '%d'",
index afd1b3874ac7e99d021de6ebba7a8b8e9f21c441..d9c2605197ff8e957ffb0346dba78d85d3e1dab7 100644 (file)
@@ -20,6 +20,7 @@ enum fsmonitor_reason {
        FSMONITOR_REASON_ERROR, /* FS error probing for compatibility */
        FSMONITOR_REASON_REMOTE,
        FSMONITOR_REASON_VFS4GIT, /* VFS for Git virtualization */
+       FSMONITOR_REASON_NOSOCKETS, /* NTFS,FAT32 do not support Unix sockets */
 };
 
 void fsm_settings__set_ipc(struct repository *r);