public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Paul Tarjan via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Paul Tarjan <github@paulisageek.com>
Subject: Re: [PATCH v7 06/10] fsmonitor: deduplicate settings logic for Unix platforms
Date: Wed, 4 Mar 2026 08:43:02 +0100	[thread overview]
Message-ID: <aafihm4MVoVOaD2l@pks.im> (raw)
In-Reply-To: <0a83bb9c8e71f6c388a50eb62afd03680020eb94.1772065643.git.gitgitgadget@gmail.com>

On Thu, Feb 26, 2026 at 12:27:19AM +0000, Paul Tarjan via GitGitGadget wrote:
> diff --git a/Makefile b/Makefile
> index 7480ce3e1d..062347997a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2365,15 +2365,11 @@ ifdef FSMONITOR_DAEMON_BACKEND
>  	COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
>  	COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
>  	COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
> -ifeq ($(FSMONITOR_DAEMON_BACKEND),win32)
> -	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-win32.o
> -else
> -	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-unix.o
> -endif
>  endif
>  
>  ifdef FSMONITOR_OS_SETTINGS
>  	COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
> +	COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_OS_SETTINGS).o
>  	COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
>  	COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_DAEMON_BACKEND).o
>  endif

It's a bit weird that the only change to the Makefile here is to change
how we wire up fsm-ipc even though it's fsm-settings that this commit
cares about. Should this change be moved into the preceding commit?

> diff --git a/compat/fsmonitor/fsm-settings-darwin.c b/compat/fsmonitor/fsm-settings-unix.c
> similarity index 82%
> rename from compat/fsmonitor/fsm-settings-darwin.c
> rename to compat/fsmonitor/fsm-settings-unix.c
> index a382590635..27d89207af 100644
> --- a/compat/fsmonitor/fsm-settings-darwin.c
> +++ b/compat/fsmonitor/fsm-settings-unix.c
> @@ -5,7 +5,7 @@
>  #include "fsmonitor-settings.h"
>  #include "fsmonitor-path-utils.h"
>  
> - /*
> +/*
>   * For the builtin FSMonitor, we create the Unix domain socket for the
>   * IPC in the .git directory.  If the working directory is remote,
>   * then the socket will be created on the remote file system.  This
> @@ -22,25 +22,31 @@
>   * 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_uds_volume(struct repository *r)
>  {
>  	struct fs_info fs;
>  	const char *ipc_path = fsmonitor_ipc__get_path(r);
> -	struct strbuf path = STRBUF_INIT;
> -	strbuf_add(&path, ipc_path, strlen(ipc_path));
> +	char *path;
> +	char *dir;
> +
> +	/*
> +	 * Create a copy for dirname() since it may modify its argument.
> +	 */
> +	path = xstrdup(ipc_path);
> +	dir = dirname(path);
>  
> -	if (fsmonitor__get_fs_info(dirname(path.buf), &fs) == -1) {
> -		strbuf_release(&path);
> +	if (fsmonitor__get_fs_info(dir, &fs) == -1) {
> +		free(path);
>  		return FSMONITOR_REASON_ERROR;
>  	}
>  
> -	strbuf_release(&path);
> +	free(path);
>  
>  	if (fs.is_remote ||
> -		!strcmp(fs.typename, "msdos") ||
> -		!strcmp(fs.typename, "ntfs")) {
> +	    !strcmp(fs.typename, "msdos") ||
> +	    !strcmp(fs.typename, "ntfs") ||
> +	    !strcmp(fs.typename, "vfat")) {
>  		free(fs.typename);
>  		return FSMONITOR_REASON_NOSOCKETS;
>  	}

Same here, it's not clear to me where those while-at-it changes are
coming from and whether we need them here. I'd rather drop them.

> diff --git a/meson.build b/meson.build
> index 8de795f9d4..589624f399 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1320,10 +1320,13 @@ else
>  endif
>  
>  fsmonitor_backend = ''
> +fsmonitor_os = ''
>  if host_machine.system() == 'windows'
>    fsmonitor_backend = 'win32'
> +  fsmonitor_os = 'win32'
>  elif host_machine.system() == 'darwin'
>    fsmonitor_backend = 'darwin'
> +  fsmonitor_os = 'unix'
>    libgit_dependencies += dependency('CoreServices')
>  endif
>  if fsmonitor_backend != ''

I think it might make sense to introduce the `fsmonitor_os` variable in
the preceding commit already. If so...

> @@ -1334,17 +1337,12 @@ if fsmonitor_backend != ''
>      'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
>      'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
>      'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
> -    'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
> +    'compat/fsmonitor/fsm-ipc-' + fsmonitor_os + '.c',
> +    'compat/fsmonitor/fsm-settings-' + fsmonitor_os + '.c',
>    ]
> -
> -  if fsmonitor_backend == 'win32'
> -    libgit_sources += 'compat/fsmonitor/fsm-ipc-win32.c'
> -  else
> -    libgit_sources += 'compat/fsmonitor/fsm-ipc-unix.c'
> -  endif
>  endif

We could avoid the flip-flopping of the code here.

Patrick

  reply	other threads:[~2026-03-04  7:43 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30  8:14 [PATCH] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2025-12-30 11:38 ` Junio C Hamano
2025-12-30 12:08 ` [PATCH v2] " Paul Tarjan via GitGitGadget
2025-12-30 12:55   ` [PATCH v3] " Paul Tarjan via GitGitGadget
2025-12-31 17:41     ` [PATCH v4] " Paul Tarjan via GitGitGadget
2026-01-05 12:07       ` Patrick Steinhardt
2026-02-20 22:18         ` Junio C Hamano
2026-02-21 16:15           ` Paul Tarjan
2026-02-21 17:07             ` Junio C Hamano
2026-02-23  6:34               ` Patrick Steinhardt
2026-02-23 15:42                 ` Junio C Hamano
2026-02-23 15:46                   ` Patrick Steinhardt
2026-02-24  1:34                     ` Paul Tarjan
2026-02-24  8:03                       ` Patrick Steinhardt
2026-02-24  1:31       ` [PATCH v5] " Paul Tarjan via GitGitGadget
2026-02-24  8:03         ` Patrick Steinhardt
2026-02-25 20:17         ` [PATCH v6 00/10] " Paul Tarjan via GitGitGadget
2026-02-25 20:17           ` [PATCH v6 01/10] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2026-02-25 21:01             ` Junio C Hamano
2026-02-25 20:17           ` [PATCH v6 02/10] fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon Paul Tarjan via GitGitGadget
2026-02-25 20:17           ` [PATCH v6 03/10] compat/win32: add pthread_cond_timedwait Paul Tarjan via GitGitGadget
2026-02-25 20:17           ` [PATCH v6 04/10] fsmonitor: use pthread_cond_timedwait for cookie wait Paul Tarjan via GitGitGadget
2026-02-25 21:13             ` Junio C Hamano
2026-02-27  6:31               ` Paul Tarjan
2026-02-27 16:44                 ` Junio C Hamano
2026-02-28  0:28                   ` Paul Tarjan
2026-02-25 21:17             ` Junio C Hamano
2026-02-27  6:31               ` Paul Tarjan
2026-02-25 20:17           ` [PATCH v6 05/10] fsmonitor: deduplicate IPC path logic for Unix platforms Paul Tarjan via GitGitGadget
2026-02-25 21:30             ` Junio C Hamano
2026-02-27  6:31               ` Paul Tarjan
2026-02-25 20:17           ` [PATCH v6 06/10] fsmonitor: deduplicate settings " Paul Tarjan via GitGitGadget
2026-02-25 21:31             ` Junio C Hamano
2026-02-27  6:31               ` Paul Tarjan
2026-02-25 20:17           ` [PATCH v6 07/10] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-02-25 20:17           ` [PATCH v6 08/10] fsmonitor: add tests " Paul Tarjan via GitGitGadget
2026-02-25 20:17           ` [PATCH v6 09/10] run-command: add close_fd_above_stderr option Paul Tarjan via GitGitGadget
2026-02-25 21:41             ` Junio C Hamano
2026-02-25 20:17           ` [PATCH v6 10/10] fsmonitor: close inherited file descriptors and detach in daemon Paul Tarjan via GitGitGadget
2026-02-26  0:27           ` [PATCH v7 00/10] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-02-26  0:27             ` [PATCH v7 01/10] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2026-03-04  7:42               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 02/10] fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon Paul Tarjan via GitGitGadget
2026-03-04  7:42               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 03/10] compat/win32: add pthread_cond_timedwait Paul Tarjan via GitGitGadget
2026-03-04  7:42               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 04/10] fsmonitor: use pthread_cond_timedwait for cookie wait Paul Tarjan via GitGitGadget
2026-03-04  7:42               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 05/10] fsmonitor: deduplicate IPC path logic for Unix platforms Paul Tarjan via GitGitGadget
2026-03-04  7:42               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 06/10] fsmonitor: deduplicate settings " Paul Tarjan via GitGitGadget
2026-03-04  7:43               ` Patrick Steinhardt [this message]
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 07/10] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-04  7:43               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 08/10] fsmonitor: add tests " Paul Tarjan via GitGitGadget
2026-03-04  7:43               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26  0:27             ` [PATCH v7 09/10] run-command: add close_fd_above_stderr option Paul Tarjan via GitGitGadget
2026-02-26  0:27             ` [PATCH v7 10/10] fsmonitor: close inherited file descriptors and detach in daemon Paul Tarjan via GitGitGadget
2026-03-04  7:43               ` Patrick Steinhardt
2026-03-04 18:17                 ` Paul Tarjan
2026-02-26 15:34             ` [PATCH v7 00/10] fsmonitor: implement filesystem change listener for Linux Junio C Hamano
2026-03-04 18:15             ` [PATCH v8 00/12] " Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 01/12] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 02/12] fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 03/12] compat/win32: add pthread_cond_timedwait Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 04/12] fsmonitor: use pthread_cond_timedwait for cookie wait Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 05/12] fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 06/12] fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 07/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 08/12] run-command: add close_fd_above_stderr option Paul Tarjan via GitGitGadget
2026-03-04 20:51                 ` Junio C Hamano
2026-03-05  0:49                   ` [PATCH v8 09/12] " Paul Tarjan
2026-03-05  4:13                     ` Junio C Hamano
2026-03-05  6:38                       ` [PATCH v9 09/12] run-command: add pre-exec callback for child processes Paul Tarjan
2026-03-04 18:15               ` [PATCH v8 09/12] fsmonitor: close inherited file descriptors and detach in daemon Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 10/12] fsmonitor: add timeout to daemon stop command Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 11/12] fsmonitor: add tests for Linux Paul Tarjan via GitGitGadget
2026-03-04 18:15               ` [PATCH v8 12/12] fsmonitor: convert shown khash to strset in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  0:51               ` [PATCH v9 00/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 01/12] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 02/12] fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 03/12] compat/win32: add pthread_cond_timedwait Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 04/12] fsmonitor: use pthread_cond_timedwait for cookie wait Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 05/12] fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 06/12] fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 07/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 08/12] run-command: add pre-exec callback for child processes Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 09/12] fsmonitor: close inherited file descriptors and detach in daemon Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 10/12] fsmonitor: add timeout to daemon stop command Paul Tarjan via GitGitGadget
2026-03-05  0:51                 ` [PATCH v9 11/12] fsmonitor: add tests for Linux Paul Tarjan via GitGitGadget
2026-03-05  0:52                 ` [PATCH v9 12/12] fsmonitor: convert shown khash to strset in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  1:16                 ` [PATCH v10 00/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 01/12] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 02/12] fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 03/12] compat/win32: add pthread_cond_timedwait Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 04/12] fsmonitor: use pthread_cond_timedwait for cookie wait Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 05/12] fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 06/12] fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 07/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 08/12] run-command: add pre-exec callback for child processes Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 09/12] fsmonitor: close inherited file descriptors and detach in daemon Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 10/12] fsmonitor: add timeout to daemon stop command Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 11/12] fsmonitor: add tests for Linux Paul Tarjan via GitGitGadget
2026-03-05  1:16                   ` [PATCH v10 12/12] fsmonitor: convert shown khash to strset in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  6:55                   ` [PATCH v11 00/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 01/12] fsmonitor: fix khash memory leak in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 02/12] fsmonitor: fix hashmap memory leak in fsmonitor_run_daemon Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 03/12] compat/win32: add pthread_cond_timedwait Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 04/12] fsmonitor: use pthread_cond_timedwait for cookie wait Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 05/12] fsmonitor: rename fsm-ipc-darwin.c to fsm-ipc-unix.c Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 06/12] fsmonitor: rename fsm-settings-darwin.c to fsm-settings-unix.c Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 07/12] fsmonitor: implement filesystem change listener for Linux Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 08/12] run-command: add close_fd_above_stderr option Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 09/12] fsmonitor: close inherited file descriptors and detach in daemon Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 10/12] fsmonitor: add timeout to daemon stop command Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 11/12] fsmonitor: add tests for Linux Paul Tarjan via GitGitGadget
2026-03-05  6:55                     ` [PATCH v11 12/12] fsmonitor: convert shown khash to strset in do_handle_client Paul Tarjan via GitGitGadget
2026-03-05  7:37                     ` [PATCH v11 00/12] fsmonitor: implement filesystem change listener for Linux Patrick Steinhardt
2026-03-05 14:15                       ` Paul Tarjan
2026-03-25 20:00                       ` Junio C Hamano
2025-12-30 15:37   ` [PATCH v2] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aafihm4MVoVOaD2l@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=github@paulisageek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox