From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#57536: 28.1; filenotify problems on macOS with symbolic links to directories Date: Sun, 04 Sep 2022 13:42:16 +0200 Message-ID: <87h71nbc2v.fsf@gmx.de> References: <890113EA-44AF-42FB-87AF-130D7AB164AD@easesoftware.com> <83edwuqome.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14577"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Perry Smith , 57536@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 04 13:44:32 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oUo3E-0003fT-1r for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Sep 2022 13:44:32 +0200 Original-Received: from localhost ([::1]:49796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUo3C-0003SA-Kc for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Sep 2022 07:44:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUo2k-0003PK-Vx for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2022 07:44:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUo2k-00050Z-6M for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2022 07:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUo2j-0004LO-U6 for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2022 07:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Sep 2022 11:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57536 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57536-submit@debbugs.gnu.org id=B57536.166229179316631 (code B ref 57536); Sun, 04 Sep 2022 11:44:01 +0000 Original-Received: (at 57536) by debbugs.gnu.org; 4 Sep 2022 11:43:13 +0000 Original-Received: from localhost ([127.0.0.1]:43620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUo1x-0004KA-GF for submit@debbugs.gnu.org; Sun, 04 Sep 2022 07:43:13 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:49717) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUo1t-0004Jv-V3 for 57536@debbugs.gnu.org; Sun, 04 Sep 2022 07:43:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1662291740; bh=Lt5ZPaYdRMTWePcOOW/U+DJVCRh57ayR715hPRzxD6U=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=aQ/bn+Qv12Ew2HyjpoMwoPlFOPA++nBVk17ZEEg7wKOPEylY8aZ/Zv1Qhyu39V+Kg vzAtfuR64dEsYnqIHA2a7OqgFWtZE1eMAZ3yJvalOH9w6WYmx7SuzqEr5hYyrnajhK h+Dy8HRerbPiiOuFCTTIuje9/Epvv+nmbbDSIlJU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.149.173]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MSKu0-1oxUzE2Ps0-00Sf0L; Sun, 04 Sep 2022 13:42:20 +0200 In-Reply-To: <83edwuqome.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 02 Sep 2022 09:25:29 +0300") X-Provags-ID: V03:K1:WVuNpsHC5feDxW1fctG0ubSCMFY6W62ioUkY3SXi/S+7oXudNtL RKcpSyxa9WQJp6hb4HKxCs1UhWfgAUkPY6QVLSHrg60KcBJyZs7aZpI9hjZ4ogg3zVYH5KW 1BwT2Cx2/EE10iV69EcejtlsM3rAeDbCd4FHQdqTG8HYP6UsLI3zIo4UZurDzhHMmwlZSLt TkPOn76PQ/Gf6Yb+pz5rg== X-UI-Out-Filterresults: notjunk:1;V03:K0:+E/4YTxnw4s=:NE5ngm6mpaWZQqKS0yNhqJ X6TZeU5Zl6ztgd+uvlxbNze2vdl7VmqbVbmnrrpN0fhC5v7ZwM0uo/87lQmOexcg3bVbDbNhD f7m85dKNSz73pax4AzORMgB9EB53DELmKDrgSV6PYzibqi+B1eFE8IGbWWQuxonjMXBzf/6FB hSyHScym5p9bkKsdf5oxoLkZTAEqoLLziLnaGqbMmFo2lvE/+zJF3QwGGqUBIeQDfo2wertKV 8TnfjPR4Z334VidM7XvmfMPagUMulIIbH51/8VakHgaxtIh2YM6fKbJv0ZIV25xJbvaP7ZDSQ 9FuldcSSAEQuPIiOBHSpUPMfVHGvGS5yFXBHDhOy6aiJ4fZLAqYkOnRluPYepeCxLNDJARJYe o3y7EW76ump8hZx/azPhoyzoC2/35dbe8hOqFhBRTPlKqHSvQojCYkJj8cbck4P/DUtZoLStU 88qyc4sMnFJtZu9uKkDtqUjS5tVwJ7slTyy9SAgF/9x/OWRf/mw+bpAPhRnXURSegyC9phGDb 5ixlgXx/2G0Lld4URPI7SWr19eXRmPn5ZZ58jz9WxIslXJjdguWplILi4TvlcjWS9u7BM1CiJ bX0QSLeceGNQYa1C2UzHRpl0Q4zwBgdznOE854/AqesslXgtSDW0NdtACHeyLh+JBCr5Oywbr P3bR9VkHk4uPERQn77VSfEaK2pp1Kd15tFGVzzLcPyruhF7kIZL5/7gjwyZNiqoH4uHOrzWFo MD6q6Y+oLQ7Y7rjCG2rfoNdPPCblXo1kCFHqOSMFmxK8De02HGmwB0Cqd4yMsCs2PM+lIfgg X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241499 Archived-At: Eli Zaretskii writes: Hi, >> Referencing these commands: >> ; 1 >> (require 'filenotify) >> >> ; 2 >> (defun my-callback (directory) >> (message (format "called %s" directory))) >> >> ; 3 >> (file-notify-add-watch "/private/tmp" '(change attribute-change) 'my-c= allback) >> >> ; 4 >> (file-notify-add-watch "/tmp" '(change attribute-change) 'my-callback) >> >> Starting with a fresh emacs -Q, if I execute lines 1, 2, and 3 and then >> touch a file such as /tmp/OUT, I get the notification as I should. >> >> However if I start fresh, execute lines 1, 2, and 4, and touch /tmp/OUT= , >> I do not get a notification. >> >> On a Mac, /tmp is a symbolic link to private/tmp (relative path). > > I don't see any bug here. If file-notify-add-watch would resolve > symlinks of its argument, we would be unable to watch changes to the > symlink file itself. I agree. Emacs' file notifications are not designed to follow symlinks. The manual in (info "(elisp) File Notifications") is silent about, perhaps we shall clarify. > So if you want to watch changes for the target of a symlink, your Lisp > program needs to resolve symlinks, e.g. by calling file-truename or > something similar. Yep. >> I first discovered this issue using Helm's find-file and I entered a >> report with Helm. The Helm developer reports that it works in his case >> with Linux. > > That could be a (mis)feature of our use of inotify, which is used on > GNU/Linux for implementing file notifications. AFAIU, inotify allows > control on whether to follow symlinks when setting a watch, and its > default is to follow symlinks. I think we should call inotify so as > not to follow symlinks. Yep. We shall go through our f-n libraries and check the current behavior, preferred by a new test case. And we shall adjust the libraries to behave similar. Will do next days. Btw, there are bug#16113 and bug#18883, which report a similar problem in auto-reverting. A possible solution could be to extend the FLAGS arg of file-notify-add-watch by a condition 'follow', which means to supervise the expanded symlink instead of the link file itself. inotify knows the mask bit IN_DONT_FOLLOW (which we haven't set yet), see inotify(7). Other libraries might offer similar possibilities, which I haven't checked yet. Best regards, Michael.