From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#35418: [PATCH] Don't poll auto-revert files that use notification Date: Sat, 27 Apr 2019 11:27:30 +0200 Message-ID: <875zqzssql.fsf@gmx.de> References: <83sgu71b91.fsf@gnu.org> <74CB5185-5DA1-4786-BD9C-9EEB3D43B3C1@acm.org> <83o94uz9h2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="4863"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 35418@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 27 11:28:19 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hKJd5-00019R-0V for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Apr 2019 11:28:19 +0200 Original-Received: from localhost ([127.0.0.1]:57704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKJd4-00040l-0C for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Apr 2019 05:28:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKJcp-0003zL-Sl for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 05:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hKJco-0006oB-Mg for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 05:28:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49006) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hKJco-0006o0-AK for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 05:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hKJco-0000kf-1W for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 05:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Apr 2019 09:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35418 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35418-submit@debbugs.gnu.org id=B35418.15563572682866 (code B ref 35418); Sat, 27 Apr 2019 09:28:01 +0000 Original-Received: (at 35418) by debbugs.gnu.org; 27 Apr 2019 09:27:48 +0000 Original-Received: from localhost ([127.0.0.1]:34317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKJcZ-0000k9-Ih for submit@debbugs.gnu.org; Sat, 27 Apr 2019 05:27:47 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:52193) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKJcV-0000jq-6H for 35418@debbugs.gnu.org; Sat, 27 Apr 2019 05:27:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1556357252; bh=gQcXnJKAgtClj+/MJICdVC8TD1w82S7HooKKxn05A1c=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=UnTleEH11dnVo6jVGdCTXG424nkyahLE2oKIpQlPfUEmajVYsCG7txIbGiOxVu60f ten95OalVsm0/I8CNVhrp4ea8ABidkFsxk0n6DpcP8yADcmG4/hFz8tCTn65I14xfP ZNeQrK+7H9KYYbQTaQDM33PXPGITqhl7jMgPkNJ8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([212.86.57.174]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LnDof-1gr3oU3gjd-00hNYV; Sat, 27 Apr 2019 11:27:32 +0200 In-Reply-To: <83o94uz9h2.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 25 Apr 2019 13:04:57 +0300") X-Provags-ID: V03:K1:rg2sQUCReaqa1hd1KR+9IedXPaCvO+9Ddw6Ojft3ANCaS++XDta pIpoJB/q6ukcEDt2s4hpUZy8HykvU7B+Ga3b5mnHtcwe7gm73dnqK1ZpmV/ua/T91cfczpV d87XXADAuz3eHustzqtMFyd8Iw1/L/eCt/fmxK1VHyNTpbTYlIe2WOlU/OtwvrUqos5Ynzv UcdXN1ub+/QG8QpRO9jUg== X-UI-Out-Filterresults: notjunk:1;V03:K0:nUmNYm9HdhM=:dpkkEnoIg0pdilcIGAHbfN x8DIsTSvxMpI7VtgTPFJsu9+jiciOF6sfVqT/MHNkobte8QJwqdt1NHZdnp/uBCy+tLJsHyq5 oztYxeU936c7z3Tg2/EJrhFK5kAgwSSihnr2nhqc17wojzUoSuX27z0rfkH3SZhW7AFDETzWs VvDMKMB2lWQpUoitAnxLVYH8C7YxsqXnDQJZ4xbGasRPvyBwLpp/x5YmWu17mQ8kWATU9L3sE hDiB9xITxYwHdZTbIBlQvg0JkcvnXsoSEDOFJP8gFxSipTZtAHJkCfl6GCQZhejco5D+j5/G5 sQgKhXvKudp9IiR5WkBpx+X3EfjedS9Gpj5d5jij42EAk7O1GGRgq/y1hO8dKBAh/kxT7C8wS eg3G8yKp+zSVn1hCNJCBrCZw/1vKqmxq/KHjIpnEbK1EgmS451z2bLoyx5Ct5EnYWt6QwMG9v /zSdz13cve3JmDG+NyTEKIZAAAuncWNhk6VX1n2s/oXGq8x0XOAymWlbtyZU48UrwaV/Z3FqP M9sJstN+RjaTq2WhA8wNdacqFwWpM/LpUWLGUgs16ZbCKA2EHVw2BH/wMt9Ju/mJDdkS6J40h dEQgCRcV2iNwvVlbGvrQdzzIvIsJSmD35aabXcn998p7E/IjtPHj/KYaDClmA8SSgatYsofLX RhN1XrVuS0y9fQFVByM5yOf/yUwhAxeAtqHVpPhoa7iTJd2gcMmVYJiqjKT317mXNhtEm7WNa iEJImyc71Ff5dcOfIZteTLrbjZJwUpUL2PjTndc/SU0uQXjKgOEEDqO3MYkFksC3QaZ6HSS1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158334 Archived-At: Eli Zaretskii writes: Hi, >> > If you look at bug reports and discussions around the time this >> > comment was written, you will find the descriptions of the use cases >> > that caused this design. AFAIR, the main problem was with inotify, >> > not with w32notify. >> >> The inotify problems at the time seem to have stemmed from not using >> unique notification descriptors. This was fixed some time ago >> (158bb8555d etc, bug#26126). > > I'll let Michael decide on this. Well, in inotify you still get undesired notifications. Like this: =2D-8<---------------cut here---------------start------------->8--- (write-region "foo" nil "/tmp/foo") (add-name-to-file "/tmp/foo" "/tmp/bar" 'ok) (inotify-add-watch "/tmp/foo" t (lambda (event) (message "inotify %S" even= t))) =3D> (1 . 0) (inotify-add-watch "/tmp/bar" t (lambda (event) (message "inotify %S" even= t))) =3D> (1 . 1) (write-region "foo" nil "/tmp/foo") =3D> inotify ((1 . 0) (modify) "/tmp/foo" 0) inotify ((1 . 1) (modify) "/tmp/bar" 0) inotify ((1 . 0) (open) "/tmp/foo" 0) inotify ((1 . 1) (open) "/tmp/bar" 0) inotify ((1 . 0) (modify) "/tmp/foo" 0) inotify ((1 . 1) (modify) "/tmp/bar" 0) inotify ((1 . 0) (close-write) "/tmp/foo" 0) inotify ((1 . 1) (close-write) "/tmp/bar" 0) =2D-8<---------------cut here---------------end--------------->8--- However, in filenotify this is fixed: =2D-8<---------------cut here---------------start------------->8--- (file-notify-add-watch "/tmp/foo" '(change attribute-change) (lambda (event) (message "file-notify %S" event))) =3D> (2 . 0) (file-notify-add-watch "/tmp/bar" '(change attribute-change) (lambda (event) (message "file-notify %S" event))) =3D> (2 . 1) (write-region "foo" nil "/tmp/foo") =3D> file-notify ((2 . 0) changed "/tmp/foo") inotify ((1 . 0) (modify) "/tmp/foo" 0) inotify ((1 . 1) (modify) "/tmp/bar" 0) inotify ((1 . 0) (open) "/tmp/foo" 0) inotify ((1 . 1) (open) "/tmp/bar" 0) file-notify ((2 . 0) changed "/tmp/foo") inotify ((1 . 0) (modify) "/tmp/foo" 0) inotify ((1 . 1) (modify) "/tmp/bar" 0) inotify ((1 . 0) (close-write) "/tmp/foo" 0) inotify ((1 . 1) (close-write) "/tmp/bar" 0) =2D-8<---------------cut here---------------end--------------->8--- Unrelated events for "/tmp/bar" are filtered out in `file-notify-callback'. So yes, the inotify problems seem to be fixed. >> Are you arguing that the default value of >> auto-revert-notify-exclude-dir-regexp should not be extended in the >> proposed way, or that the variable is fundamentally incompatible >> with the patch? > > I'm questioning the usefulness of extending the default value, yes. > But I don't have strong views on that. We might extend this variable. *If* this regexp matches a file name, we know that we need polling. But it is clear, that we cannot catch all cases by just parsing file names. (Btw, we should use the value of `mounted-file-systems', introduced in Emacs 26.1, when initializing `auto-revert-notify-exclude-dir-regexp'.) One alternative approach could be to analyze the file system device number, as returned by `file-attributes'. By this, we could detect mounted file systems. But I don't believe that this information is always trustworty, given it isn't used anywhere. And at least for remote files it doesn't tell you anything. Furthermore, mounted file systems are not the only reason that file notification doesn't work, and we need to poll. > Thanks. Best regards, Michael.