all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Robert Pluim <rpluim@gmail.com>
Cc: 21337@debbugs.gnu.org
Subject: bug#21337: 25.0.50; inotify error message
Date: Mon, 24 Aug 2015 22:36:02 +0300	[thread overview]
Message-ID: <83si78fpi5.fsf@gnu.org> (raw)
In-Reply-To: <87io84pmec.fsf@gmail.com>

> From: Robert Pluim <rpluim@gmail.com>
> Cc: 21337@debbugs.gnu.org
> Date: Mon, 24 Aug 2015 20:32:59 +0200
> 
> strace indicates that the directory where emacs is being run from is
> being watched, along with my home directory plus any directories
> containing files that are being visited. What's strange is that
> inotify_add_watch is being called 22 times for the current directory.

Can you see which code causes these 22 calls for the same directory?

> I've debugged inotify_callback a little. The expectation of this code
> 
>   to_read = 0;
>   if (ioctl (fd, FIONREAD, &to_read) == -1)
>     xsignal1
>       (Qfile_notify_error,
>        build_string ("Error while trying to retrieve file system events"));
>   buffer = xmalloc (to_read);
>   n = read (fd, buffer, to_read);
>   if (n < 0)
>     {
> 
> is that the read will succeed, however to_read is very often 0, so
> it's not surprising the read fails.

That's strange, isn't it?  If to_read is zero, how come pselect
indicated that FD has stuff to be read?

> (what does xmalloc do when its argument is 0?)

Nothing, usually.

> My understanding was that the callback should only be called when
> there are actual inotify events to process, so this behaviour is
> somewhat surprising to me.

Exactly.

Could it be that we are somehow trying to read the same event 22
times, and then only the 1st time succeeds?

> I can add in skipping the read if to_read == 0, but I suspect that's
> just papering over the cracks.

The important question is, IMO, how come pselect says this FD is ready
to be read, when there's nothing to be read.

Btw, it would be nice to have errno description added to the error
message.

Thanks.





  reply	other threads:[~2015-08-24 19:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 12:12 bug#21337: 25.0.50; inotify error message Robert Pluim
2015-08-24 15:52 ` Eli Zaretskii
2015-08-24 16:22   ` Robert Pluim
2015-08-24 16:34     ` Eli Zaretskii
2015-08-24 16:51       ` Robert Pluim
2015-08-24 17:18         ` Eli Zaretskii
2015-08-24 18:32           ` Robert Pluim
2015-08-24 19:36             ` Eli Zaretskii [this message]
2015-08-26 17:02               ` Robert Pluim
2015-08-28 13:30                 ` Eli Zaretskii
2015-09-05  8:38                   ` Eli Zaretskii
2015-09-07  7:21                 ` Tassilo Horn
2015-09-07  7:43                   ` Robert Pluim
2015-09-07 15:01                     ` Eli Zaretskii
2015-09-07 15:15                       ` Robert Pluim
2015-09-09 16:49                         ` Tassilo Horn
2015-09-09 17:57                           ` 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=83si78fpi5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=21337@debbugs.gnu.org \
    --cc=rpluim@gmail.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.