From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57536: 28.1; filenotify problems on macOS with symbolic links to directories Date: Fri, 02 Sep 2022 09:25:29 +0300 Message-ID: <83edwuqome.fsf@gnu.org> References: <890113EA-44AF-42FB-87AF-130D7AB164AD@easesoftware.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35783"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57536@debbugs.gnu.org To: Perry Smith , Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 02 08:26:50 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 1oU08f-0009AD-RK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 08:26:50 +0200 Original-Received: from localhost ([::1]:39788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oU08e-0000PO-BY for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 02:26:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU07u-0000Nz-Sz for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 02:26:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oU07u-0004rV-KJ for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 02:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oU07u-0006m6-BB for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 02:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Sep 2022 06:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57536 X-GNU-PR-Package: emacs Original-Received: via spool by 57536-submit@debbugs.gnu.org id=B57536.166209990925971 (code B ref 57536); Fri, 02 Sep 2022 06:26:02 +0000 Original-Received: (at 57536) by debbugs.gnu.org; 2 Sep 2022 06:25:09 +0000 Original-Received: from localhost ([127.0.0.1]:44642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oU072-0006kp-Lg for submit@debbugs.gnu.org; Fri, 02 Sep 2022 02:25:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oU071-0006kG-1A for 57536@debbugs.gnu.org; Fri, 02 Sep 2022 02:25:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU06v-0004QW-Cc; Fri, 02 Sep 2022 02:25:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GleAe8OieahbiaTdWVPkfpnvZUov7cUhAg2bMUHu1ms=; b=paLe20PyFXPO TW8QZApg92pYhGCmS5CBWKT4HEWfqCL+3RapyePg/tOn4pF9Da1dyYchKjtYeXVbATvxYHhz+6n5f PyYbHdeiRz1EHP8bBpZAuvv5UYbCfM9+J9LI0vY/gYVfovyRgTkp3YU76ODdEsrB00+EKhJ66MIGU VzdU4T9WtaaDTELrYVKnCN8ogXN4/LDHN9jrVtcS+U3i6FoXSVJwsZV96s10Wa67kdmNwk9Fge+Ck 7vGTvI6Fq3hOUUQP5WdWCUUmFq/nlf6sdpYo+zXYYFyvEzOahKdf3KZP6SYBHW/WSpBLLVE2+BMyY Beqse7Bq68Svg7myDVOOUA==; Original-Received: from [87.69.77.57] (port=1889 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU06u-0004Ky-R7; Fri, 02 Sep 2022 02:25:01 -0400 In-Reply-To: <890113EA-44AF-42FB-87AF-130D7AB164AD@easesoftware.com> (message from Perry Smith on Thu, 1 Sep 2022 18:34:39 -0500) 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:241289 Archived-At: > From: Perry Smith > Date: Thu, 1 Sep 2022 18:34:39 -0500 > > 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-callback) > > ; 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. 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. > 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. Michael, WDYT?