unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
       [not found] <E1Vq26z-00077J-TF@vcs.savannah.gnu.org>
@ 2013-12-10  2:30 ` Stefan Monnier
  2013-12-10  3:49   ` Eli Zaretskii
  2013-12-10  4:37   ` Michael Albinus
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2013-12-10  2:30 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

> +  (when (or (string-match auto-revert-notify-exclude-dir-regexp
> +			  (expand-file-name default-directory))
> +	    (not (file-symlink-p buffer-file-name)))

I think this patch is acceptable, but if/when we try to write a generic
file-watcher Elisp API, it would be good to make this work (probably by
adding a watcher on the symlink's target).


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  2:30 ` [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files Stefan Monnier
@ 2013-12-10  3:49   ` Eli Zaretskii
  2013-12-10  4:58     ` Michael Albinus
  2013-12-10  4:37   ` Michael Albinus
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2013-12-10  3:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael.albinus, emacs-devel

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Mon, 09 Dec 2013 21:30:53 -0500
> Cc: emacs-devel@gnu.org
> 
> > +  (when (or (string-match auto-revert-notify-exclude-dir-regexp
> > +			  (expand-file-name default-directory))
> > +	    (not (file-symlink-p buffer-file-name)))
> 
> I think this patch is acceptable, but if/when we try to write a generic
> file-watcher Elisp API, it would be good to make this work (probably by
> adding a watcher on the symlink's target).

It's up to the user to say whether she wants to watch the symlink or
its target, I think.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  2:30 ` [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files Stefan Monnier
  2013-12-10  3:49   ` Eli Zaretskii
@ 2013-12-10  4:37   ` Michael Albinus
  2013-12-10 16:38     ` Eli Zaretskii
  2013-12-11  4:37     ` Stefan Monnier
  1 sibling, 2 replies; 13+ messages in thread
From: Michael Albinus @ 2013-12-10  4:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> +  (when (or (string-match auto-revert-notify-exclude-dir-regexp
>> +			  (expand-file-name default-directory))
>> +	    (not (file-symlink-p buffer-file-name)))
>
> I think this patch is acceptable, but if/when we try to write a generic
> file-watcher Elisp API, it would be good to make this work (probably by
> adding a watcher on the symlink's target).

That was my first idea, too. But when I tried to implement this, there
were too much performance penalties, which would eat the advantages of
file notifications. So I've decided to exclude symlinks, at least until
there's a better way to support symlinks.

As far as I am aware, inotify could support symbolic links and their
targets. For glib it seems to depend on the implementation. For kqueue
(*BSD, Mac OS X; candidate as further basic library) I don't know how
it is handled.

In short, it might be necessary to extend the filenotify.el API and the
underlying libraries in order to determine how to handle
symlinks. Nothing we should do days before the feature freeze, IMHO.

>         Stefan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  3:49   ` Eli Zaretskii
@ 2013-12-10  4:58     ` Michael Albinus
  2013-12-10 15:07       ` Davis Herring
  2013-12-10 16:38       ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Michael Albinus @ 2013-12-10  4:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> I think this patch is acceptable, but if/when we try to write a generic
>> file-watcher Elisp API, it would be good to make this work (probably by
>> adding a watcher on the symlink's target).
>
> It's up to the user to say whether she wants to watch the symlink or
> its target, I think.

In general I agree. But Stefan was commenting on my change in
autorevert.el. Here it is obvious, that the target shall be watched.
I believe.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  4:58     ` Michael Albinus
@ 2013-12-10 15:07       ` Davis Herring
  2013-12-10 16:38       ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Davis Herring @ 2013-12-10 15:07 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Eli Zaretskii, Stefan Monnier, emacs-devel

> In general I agree. But Stefan was commenting on my change in
> autorevert.el. Here it is obvious, that the target shall be watched.
> I believe.

It seems to me that this is a variation on "tail -f" vs. "tail -F"; you
might even want to watch both the symlink and its target if the target
might be written or the symlink redirected.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  4:37   ` Michael Albinus
@ 2013-12-10 16:38     ` Eli Zaretskii
  2013-12-11  4:38       ` Stefan Monnier
  2013-12-11  4:37     ` Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2013-12-10 16:38 UTC (permalink / raw)
  To: Michael Albinus; +Cc: monnier, emacs-devel

> From: Michael Albinus <michael.albinus@gmx.de>
> Date: Tue, 10 Dec 2013 05:37:06 +0100
> Cc: emacs-devel@gnu.org
> 
> Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> 
> >> +  (when (or (string-match auto-revert-notify-exclude-dir-regexp
> >> +			  (expand-file-name default-directory))
> >> +	    (not (file-symlink-p buffer-file-name)))
> >
> > I think this patch is acceptable, but if/when we try to write a generic
> > file-watcher Elisp API, it would be good to make this work (probably by
> > adding a watcher on the symlink's target).
> 
> That was my first idea, too. But when I tried to implement this, there
> were too much performance penalties, which would eat the advantages of
> file notifications.

Can you tell more about these performance problems?  Suppose we always
run the file name through file-truename, before submitting it to the
notification back-end -- what problems will this create?

> As far as I am aware, inotify could support symbolic links and their
> targets. For glib it seems to depend on the implementation. For kqueue
> (*BSD, Mac OS X; candidate as further basic library) I don't know how
> it is handled.

I'd prefer that we don't delegate such a delicate issue to the
back-end, the result is likely to be even more system dependencies
than what we have now.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  4:58     ` Michael Albinus
  2013-12-10 15:07       ` Davis Herring
@ 2013-12-10 16:38       ` Eli Zaretskii
  2013-12-11  4:36         ` Stefan Monnier
  2013-12-11 15:17         ` Michael Albinus
  1 sibling, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2013-12-10 16:38 UTC (permalink / raw)
  To: Michael Albinus; +Cc: monnier, emacs-devel

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>,  emacs-devel@gnu.org
> Date: Tue, 10 Dec 2013 05:58:18 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> I think this patch is acceptable, but if/when we try to write a generic
> >> file-watcher Elisp API, it would be good to make this work (probably by
> >> adding a watcher on the symlink's target).
> >
> > It's up to the user to say whether she wants to watch the symlink or
> > its target, I think.
> 
> In general I agree. But Stefan was commenting on my change in
> autorevert.el. Here it is obvious, that the target shall be watched.
> I believe.

What if the target is a directory?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10 16:38       ` Eli Zaretskii
@ 2013-12-11  4:36         ` Stefan Monnier
  2013-12-11 15:17         ` Michael Albinus
  1 sibling, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2013-12-11  4:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Albinus, emacs-devel

>> >> I think this patch is acceptable, but if/when we try to write a generic
>> >> file-watcher Elisp API, it would be good to make this work (probably by
>> >> adding a watcher on the symlink's target).
>> > It's up to the user to say whether she wants to watch the symlink or
>> > its target, I think.

autorevert cares about keeping the buffer in sync with the contents of
the file available at buffer-file-name.  So the user has already said
what she wants.

This need could occur in other circumstances as well: inotify and
friends usually work at a "shallow" level whereas many uses of
file-tracking care about the contents (hence following any indirections
like symlinks as deeply as needed).  So a good "notification" Elisp API
should probably provide the feature.

>> In general I agree. But Stefan was commenting on my change in
>> autorevert.el. Here it is obvious, that the target shall be watched.
>> I believe.
> What if the target is a directory?

I don't understand your question: whether the target is a directory or
not doesn't seem to make any difference.


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10  4:37   ` Michael Albinus
  2013-12-10 16:38     ` Eli Zaretskii
@ 2013-12-11  4:37     ` Stefan Monnier
  2013-12-11 15:21       ` Michael Albinus
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-12-11  4:37 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

> Nothing we should do days before the feature freeze, IMHO.

100% agreement.  I just wanted to make sure we remember that what we
have is a workaround rather than a solution.


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10 16:38     ` Eli Zaretskii
@ 2013-12-11  4:38       ` Stefan Monnier
  2013-12-11 16:29         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-12-11  4:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Albinus, emacs-devel

> Can you tell more about these performance problems?  Suppose we always
> run the file name through file-truename, before submitting it to the
> notification back-end -- what problems will this create?

One obvious problem is if the user changes the symlink.


        Stefan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-10 16:38       ` Eli Zaretskii
  2013-12-11  4:36         ` Stefan Monnier
@ 2013-12-11 15:17         ` Michael Albinus
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2013-12-11 15:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: monnier, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Michael Albinus <michael.albinus@gmx.de>
>> Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>,  emacs-devel@gnu.org
>> Date: Tue, 10 Dec 2013 05:58:18 +0100
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> I think this patch is acceptable, but if/when we try to write a generic
>> >> file-watcher Elisp API, it would be good to make this work (probably by
>> >> adding a watcher on the symlink's target).
>> >
>> > It's up to the user to say whether she wants to watch the symlink or
>> > its target, I think.
>>
>> In general I agree. But Stefan was commenting on my change in
>> autorevert.el. Here it is obvious, that the target shall be watched.
>> I believe.
>
> What if the target is a directory?

This is not relevant for autorevert.el and file notifications - if the
target is a directory, file notifications are not used (yet) in
autorevert.el. I've created Bug#16112 for this.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-11  4:37     ` Stefan Monnier
@ 2013-12-11 15:21       ` Michael Albinus
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2013-12-11 15:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> Nothing we should do days before the feature freeze, IMHO.
>
> 100% agreement.  I just wanted to make sure we remember that what we
> have is a workaround rather than a solution.

I've created Bug#16113 for this.

>         Stefan

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files.
  2013-12-11  4:38       ` Stefan Monnier
@ 2013-12-11 16:29         ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2013-12-11 16:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael.albinus, emacs-devel

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: Michael Albinus <michael.albinus@gmx.de>, emacs-devel@gnu.org
> Date: Tue, 10 Dec 2013 23:38:47 -0500
> 
> > Can you tell more about these performance problems?  Suppose we always
> > run the file name through file-truename, before submitting it to the
> > notification back-end -- what problems will this create?
> 
> One obvious problem is if the user changes the symlink.

Right, but why is that a problem _performance-wise_?  So we probably
need to watch the parent directory of the symlink itself as well, so
what?



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-12-11 16:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1Vq26z-00077J-TF@vcs.savannah.gnu.org>
2013-12-10  2:30 ` [Emacs-diffs] trunk r115439: * autorevert.el (auto-revert-notify-add-watch): Do not handle symlinked files Stefan Monnier
2013-12-10  3:49   ` Eli Zaretskii
2013-12-10  4:58     ` Michael Albinus
2013-12-10 15:07       ` Davis Herring
2013-12-10 16:38       ` Eli Zaretskii
2013-12-11  4:36         ` Stefan Monnier
2013-12-11 15:17         ` Michael Albinus
2013-12-10  4:37   ` Michael Albinus
2013-12-10 16:38     ` Eli Zaretskii
2013-12-11  4:38       ` Stefan Monnier
2013-12-11 16:29         ` Eli Zaretskii
2013-12-11  4:37     ` Stefan Monnier
2013-12-11 15:21       ` Michael Albinus

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).