all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Perry Smith <pedz@easesoftware.com>,
	Michael Albinus <michael.albinus@gmx.de>
Cc: 57536@debbugs.gnu.org
Subject: bug#57536: 28.1; filenotify problems on macOS with symbolic links to directories
Date: Fri, 02 Sep 2022 09:25:29 +0300	[thread overview]
Message-ID: <83edwuqome.fsf@gnu.org> (raw)
In-Reply-To: <890113EA-44AF-42FB-87AF-130D7AB164AD@easesoftware.com> (message from Perry Smith on Thu, 1 Sep 2022 18:34:39 -0500)

> From: Perry Smith <pedz@easesoftware.com>
> 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?





  reply	other threads:[~2022-09-02  6:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 23:34 bug#57536: 28.1; filenotify problems on macOS with symbolic links to directories Perry Smith
2022-09-02  6:25 ` Eli Zaretskii [this message]
2022-09-04 11:42   ` Michael Albinus
2022-09-04 13:10     ` Eli Zaretskii
2022-09-04 14:26       ` Michael Albinus
2022-09-04 14:49         ` Eli Zaretskii
2022-09-07 12:20           ` Eli Zaretskii
2022-09-07 15:57             ` Michael Albinus
2022-09-16 15:27           ` Michael Albinus
2022-09-16 15:56             ` Eli Zaretskii
2022-09-16 16:39               ` Michael Albinus
2022-09-17  9:02                 ` Michael Albinus
2022-09-17  9:43                   ` Eli Zaretskii
2022-09-17 13:16                     ` Michael Albinus
2022-09-17 14:07                       ` Eli Zaretskii
2022-09-17 15:03                         ` Michael Albinus
2022-09-17 13:27           ` Michael Albinus
2022-09-17 13:53             ` Eli Zaretskii
2022-09-17 15:15               ` Michael Albinus
2022-09-17 15:37                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83edwuqome.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=57536@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=pedz@easesoftware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.