bug#81531: 30.2; filenotify: moving file out of watched directory delays the "deleted" event until file is later moved back in

Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Eli Zaretskii <[email protected]> writes:

Hi Eli,

>> There might be the situation, that a file is moved outside the watched
>> directory, and there is a pending "removed-from" which won't be handled
>> because there is no other activity in the directory. This could be
>> mitigated by calling read-event with a short timeout (even 0.01 should
>> work), because in practive "removed-from" and "removed-to" events arrive
>> almost simultaneously. If there is no "removed-to" event after this
>> call, we could assume that "removed-from" must be reported as "deleted".
>> 
>> WDYT?
>
> AFAIU, in this case what we do was not good enough, but maybe I
> misunderstood.

According to the data the OP has provided, we have fired all expected
events. The "delete" event came later as expected, that's all. My
proposal tries to mitigate this.

Will try to implement a POC with an additional read-event after
"removed-from". This might be delayed a little bit, you know, summer
break (not mine, but our grand-son will be here).

Best regards, Michael.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.