From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#21435: 25.0.50; file-notify has problems after renames Date: Tue, 08 Sep 2015 21:05:00 +0200 Message-ID: <87wpw0g2ar.fsf@gnu.org> References: <87y4gh47sr.fsf@gnu.org> <83k2s07vaf.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441739186 19441 80.91.229.3 (8 Sep 2015 19:06:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Sep 2015 19:06:26 +0000 (UTC) Cc: 21435@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 08 21:06:14 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 1ZZODZ-0003PN-Bi for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 21:06:09 +0200 Original-Received: from localhost ([::1]:36756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZODY-0002RY-IJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Sep 2015 15:06:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZODW-0002RK-3A for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:06:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZODS-0008Rd-U6 for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:06:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZODS-0008RX-RX for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZZODS-0007bg-DJ for bug-gnu-emacs@gnu.org; Tue, 08 Sep 2015 15:06:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87y4gh47sr.fsf@gnu.org> Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Sep 2015 19:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21435-submit@debbugs.gnu.org id=B21435.144173910929178 (code B ref 21435); Tue, 08 Sep 2015 19:06:02 +0000 Original-Received: (at 21435) by debbugs.gnu.org; 8 Sep 2015 19:05:09 +0000 Original-Received: from localhost ([127.0.0.1]:52964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZOCa-0007aX-QR for submit@debbugs.gnu.org; Tue, 08 Sep 2015 15:05:09 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:54976) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZZOCZ-0007aP-1o for 21435@debbugs.gnu.org; Tue, 08 Sep 2015 15:05:08 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 785EC208B9 for <21435@debbugs.gnu.org>; Tue, 8 Sep 2015 15:05:06 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Tue, 08 Sep 2015 15:05:06 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:references:subject:to:x-sasl-enc:x-sasl-enc; s= smtpout; bh=G92dGBMR+3S8ztEdX3gRGYRm434=; b=uIuHryTEG2UdaqWpKf1T 1YPJKNGcnP99LBbxreaxSU86xatNyQy7A0P3CFBg4P6hgZhRm129Q+x1XkClFxmd 7tr05mo8rTMk6IrdKnDwhprBlgPkKsHJf6/70fLBFAsOi9VUA9EPsmPb4pqWVVQE 5cxijIszN13pecyafikrVAg= X-Sasl-enc: 0gnZvWXtgDFbJVx8+YgQiDbm/JB7FjYnyfq0Qrb3OuiO 1441739104 Original-Received: from thinkpad-t440p (unknown [2.163.188.161]) by mail.messagingengine.com (Postfix) with ESMTPA id A87BDC0028A; Tue, 8 Sep 2015 15:05:02 -0400 (EDT) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) 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:106266 Archived-At: Eli Zaretskii writes: >> Another thing is that renames always seem to be reported twice >> (although the example in the manual lists only one event but that >> example has probably gathered with the gfilenotify backend). > > This doesn't happen with w32notify. filenotify.el includes some code > to produce a single notification out of the 2 reported by back-ends in > this case; perhaps something doesn't work there with inotify. Can you > step through the code and see why? I stepped through inotify_callback in inotify.c which can read 64 byte from inotifyfd where the size of one inotify event is 32 and that produces 2 emacs events (although I cannot see which events are created). The Locals GUD frame always shows just nil for the `event' local variable even after the assignments to it and I stepped into the then-branch of an `if (!NILP(event.arg))' which makes it pretty clear that it cannot be nil. Why is that? Then I turned to `file-notify-callback'. That receives one `move-from' event and one `move-to' event which I figured out by adding a message. The problem is that as soon as I edebug the function, I can only see the first call for the `mode-from' event. After stepping through it, I won't be put into the debugger for the second event as if it has been discarded in the meantime. My handle function is also not run when edebugging. Is that expected that when edebugging event handlers one might miss events? Anyway, eventually I found and fixed the culprit which simply was that the watch descriptors of the pending and the current event were compared with `eq' which is not valid because inotify descriptors are conses. I've changed the comparison to `equal' which fixes the double-reporting issue. Bye, Tassilo