From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21337: 25.0.50; inotify error message Date: Mon, 24 Aug 2015 22:36:02 +0300 Message-ID: <83si78fpi5.fsf@gnu.org> References: <87k2skyjf2.fsf@gmail.com> <83d1ychefg.fsf@gnu.org> <87oahw8xmv.fsf@gmail.com> <83a8tghcgr.fsf@gnu.org> <87twrobpet.fsf@gmail.com> <836144hagi.fsf@gnu.org> <87io84pmec.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1440445061 21161 80.91.229.3 (24 Aug 2015 19:37:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Aug 2015 19:37:41 +0000 (UTC) Cc: 21337@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 24 21:37:30 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZTxYg-0004Tb-AH for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Aug 2015 21:37:30 +0200 Original-Received: from localhost ([::1]:56311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTxYf-0000KN-P7 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Aug 2015 15:37:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTxYI-0008Lj-HD for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2015 15:37:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTxYF-00056J-4f for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2015 15:37:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTxYF-000567-2a for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2015 15:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZTxYE-0008PH-Ku for bug-gnu-emacs@gnu.org; Mon, 24 Aug 2015 15:37: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: Mon, 24 Aug 2015 19:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21337 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21337-submit@debbugs.gnu.org id=B21337.144044497932266 (code B ref 21337); Mon, 24 Aug 2015 19:37:02 +0000 Original-Received: (at 21337) by debbugs.gnu.org; 24 Aug 2015 19:36:19 +0000 Original-Received: from localhost ([127.0.0.1]:37250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZTxXW-0008OL-PE for submit@debbugs.gnu.org; Mon, 24 Aug 2015 15:36:19 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:36775) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZTxXT-0008OB-Ot for 21337@debbugs.gnu.org; Mon, 24 Aug 2015 15:36:17 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NTL00600Q6NN200@mtaout27.012.net.il> for 21337@debbugs.gnu.org; Mon, 24 Aug 2015 22:33:12 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NTL005SGQBCX000@mtaout27.012.net.il>; Mon, 24 Aug 2015 22:33:12 +0300 (IDT) In-reply-to: <87io84pmec.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105789 Archived-At: > From: Robert Pluim > 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.