Subject: RE: [PATCH v2 00/27] Builtin FSMonitor Part 3

From: <[email-masked]>
Date: Mon, 21 Mar 2022 19:18:11 -0400

On March 21, 2022 6:06 PM, Jeff Hostetler wrote:
>On 3/13/22 6:42 AM, Torsten Bögershausen wrote:
>> Hej Jeff,
>>
>> I tried your patch on both a newer Mac and an older machine (with
>> HFS+) The older machine doesn't have kFSEventStreamEventFlagItemCloned
>> As it is an enum, and not a #define, I ended up here:
>>
>>    diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-
>listen-darwin.c
>>    index 3332d3b779..fa172a05c4 100644
>>    --- a/compat/fsmonitor/fsm-listen-darwin.c
>>    +++ b/compat/fsmonitor/fsm-listen-darwin.c
>>    @@ -169,8 +169,6 @@ static void log_flags_set(const char *path, const
>FSEventStreamEventFlags flag)
>>                    strbuf_addstr(&msg, "ItemXattrMod|");
>>            if (flag & kFSEventStreamEventFlagOwnEvent)
>>                    strbuf_addstr(&msg, "OwnEvent|");
>>    -       if (flag & kFSEventStreamEventFlagItemCloned)
>>    -               strbuf_addstr(&msg, "ItemCloned|");
>>
>>            trace_printf_key(&trace_fsmonitor, "fsevent: '%s', flags=0x%x %s",
>>                             path, flag, msg.buf);
>>    @@ -221,8 +219,7 @@ static int ef_ignore_xattr(const
>FSEventStreamEventFlags ef)
>>                    kFSEventStreamEventFlagItemModified |
>>                    kFSEventStreamEventFlagItemRemoved |
>>                    kFSEventStreamEventFlagItemRenamed |
>>    -               kFSEventStreamEventFlagItemXattrMod |
>>    -               kFSEventStreamEventFlagItemCloned;
>>    +               kFSEventStreamEventFlagItemXattrMod ;
>
>It looks like the ...Cloned bit was added to the SDK in 10.13 [1].
>All the other bits were defined sometime between 10.5 and 10.10.
>
>I'll add something in V7 to guard that bit.  I think 10.10 is old enough that we don't
>need to special case those bits too.

I realize it is a bit late in the game, but would you consider a pre-hook and post-hook that automatically run with fsmonitor kicks off/terminates. I am thinking about use cases where this is integrated into more complex processes and it would be nice to have notifications of what fsmonitor is doing and when.

Thanks,
Randall