Subject: Re: [PATCH v2] fsmonitor: implement filesystem change listener for Linux

From: Junio C Hamano <[email-masked]>
Date: Wed, 31 Dec 2025 00:37:45 +0900

Thanks for a quick turnaround, but it would be more efficient if you
hunted all the leaks yourself, instead of getting a report for one
issue and updating the patch to fix that one issue.

Here is what I am getting these:

    $ make SANITIZE=address CC=clang && cd t && sh t7527-*.sh -i -v

Note that "-i" is to say "stop at the first one".

expecting success of 7527.12 'create some files':
        test_when_finished clean_up_repo_and_stop_daemon &&

        start_daemon --tf "$PWD/.git/trace" &&

        create_files &&

        test-tool fsmonitor-client query --token 0 &&

        grep "^event: dir1/new$" .git/trace &&
        grep "^event: dir2/new$" .git/trace &&
        grep "^event: new$"      .git/trace

fsmonitor-daemon is watching '/home/gitster/w/git.git/t/trash directory.t7527-builtin-fsmonitor'
builtin:0.1039108.20251230T123036.129805Z:0/event: dir1/new
event: dir1/new
event: dir2/new
event: dir2/new
event: new
event: new
HEAD is now at 1d1edcb initial
Removing dir1/new
Removing dir2/new
Removing new
not ok 12 - create some files
#
#               test_when_finished clean_up_repo_and_stop_daemon &&
#
#               start_daemon --tf "$PWD/.git/trace" &&
#
#               create_files &&
#
#               test-tool fsmonitor-client query --token 0 &&
#
#               grep "^event: dir1/new$" .git/trace &&
#               grep "^event: dir2/new$" .git/trace &&
#               grep "^event: new$"      .git/trace
#
1..12

=================================================================
==git==1039073==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x55c18d8d4042 in calloc (git+0x8c042) (BuildId: 4097db008a82663ae0b3398128a7ab4e09bbdd21)
    #1 0x55c18dc10f14 in xcalloc wrapper.c:154:8
    #2 0x55c18d945f72 in kh_init_str builtin/fsmonitor--daemon.c:656:1
    #3 0x55c18d945828 in do_handle_client builtin/fsmonitor--daemon.c:871:10
    #4 0x55c18d945191 in handle_client builtin/fsmonitor--daemon.c:987:11
    #5 0x55c18dc283e2 in worker_thread__do_io compat/simple-ipc/ipc-unix-socket.c:532:9
    #6 0x55c18dc27a7f in worker_thread_proc compat/simple-ipc/ipc-unix-socket.c:606:9
    #7 0x55c18d8d64f4 in void* ThreadStartFunc<false>(void*) lsan_interceptors.cpp.o
    #8 0x7fe358257b7a in start_thread nptl/pthread_create.c:448:8
    #9 0x7fe3582d57b7 in __GI___clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78