From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yutian Li | =?UTF-8?Q?=E6=9D=8E=E9=9B=A8=E7=94=B0?= Newsgroups: gmane.emacs.bugs Subject: bug#21819: 24.5; Overlay modification function called with wrong arguments Date: Tue, 3 Nov 2015 00:24:41 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1446539179 23366 80.91.229.3 (3 Nov 2015 08:26:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Nov 2015 08:26:19 +0000 (UTC) To: 21819@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 03 09:26:09 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 1ZtWuu-0001p6-3u for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Nov 2015 09:26:08 +0100 Original-Received: from localhost ([::1]:46354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtWus-00005w-UQ for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Nov 2015 03:26:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtWup-00005f-AY for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:26:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtWuo-0007WC-8M for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:26:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtWuo-0007W4-4l for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZtWun-0004P1-PG for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yutian Li | =?UTF-8?Q?=E6=9D=8E=E9=9B=A8=E7=94=B0?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Nov 2015 08:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21819 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144653915216897 (code B ref -1); Tue, 03 Nov 2015 08:26:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Nov 2015 08:25:52 +0000 Original-Received: from localhost ([127.0.0.1]:50392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtWue-0004OS-3l for submit@debbugs.gnu.org; Tue, 03 Nov 2015 03:25:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42937) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZtWuc-0004OL-OS for submit@debbugs.gnu.org; Tue, 03 Nov 2015 03:25:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtWub-0007Td-J9 for submit@debbugs.gnu.org; Tue, 03 Nov 2015 03:25:50 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtWub-0007TX-GD for submit@debbugs.gnu.org; Tue, 03 Nov 2015 03:25:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtWua-00005L-8w for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:25:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtWuZ-0007Sh-4G for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:25:48 -0500 Original-Received: from mail-oi0-x229.google.com ([2607:f8b0:4003:c06::229]:35234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtWuY-0006lh-VO for bug-gnu-emacs@gnu.org; Tue, 03 Nov 2015 03:25:47 -0500 Original-Received: by oifu63 with SMTP id u63so4864529oif.2 for ; Tue, 03 Nov 2015 00:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=RrWPsxLcPEo7S6O04SzSj9GDnJQNi5n9Ms+EAHXHPzY=; b=LvudjsQZoua5SNyRsNZ3ISDDVK32oQenjNaGmGKiqe/1dNsv2bOJO3Y4JQb+bTChx9 n0i00X7R+hdqcn1D+Bv2DxE1G2up1XTsm6vKBznNLmXwPBtOsyJKLAMVbmB1IOF4/Xf/ K3A/OlMCwTugtNLRgHskY3tPb2csFbp/pmaqNu5/g8ItB5qiwdYPEhdB0MDxNLviz7Rr 9yVrzCkLM8Pj90uhT433kZVH50AeqMggHdiLXu+l3ufmuaSCYaOjENHI0suUKLYiCa27 IQw9P4u5UsBcbxSRqdftI6rC+3tSZKdcz2jMyJYK2zR2rA8lTIiDrwmPd9HIGSVKxH0A LroA== X-Received: by 10.202.173.142 with SMTP id w136mr16773452oie.128.1446539081677; Tue, 03 Nov 2015 00:24:41 -0800 (PST) Original-Received: by 10.202.227.129 with HTTP; Tue, 3 Nov 2015 00:24:41 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:108339 Archived-At: Hi. This happens on both Mac and GNU/Linux with latest release of Emacs. I also tried the master branch of `git://git.sv.gnu.org/emacs.git` and it still exists. The discussion that led to the discovery of the bug is [here](https://github.com/capitaomorte/yasnippet/issues/607). There is a stack trace on the OP. Some guesses in the bottom. There is also instructions to reproduce this. The direct cause is the modification hook registered with the overlay is called with apparently wrong arguments. The hook function is registered with an overlay in the C++ buffer, but called with `beg` and `end` referring to positions probably in the `*Messages*` buffer. As the stack trace shows, Flycheck called `message` to display a message indicating syntax errors, and `message` somehow invokes the modification hook function, which was defined in C++ buffer but called now in `*Messages*` buffer. I traced into the Emacs source file `src/buffer.c`. There is a function `report_overlay_modification`. It *should* (I guess) be called with `after` set to `false` and `true` alternatively. But on the erroneous invocation, it is called with `after` set to `true` twice consecutively. The first call `_beg` and `_end` are normal small integer (inside C++ buffer). The second call they are huge and must refer to the `*Messages*` buffer. Inside the call, it uses a global array to store overlay modification hook functions. Now it's called twice consecutively with `after` set to `true`, it must have reused old hook functions, hence the call to our function with correct overlay but wrong cursor. Because on a call with `after` set to `false`, it will "clear" the hook functions. Best regards, Yutian LI | =E6=9D=8E=E9=9B=A8=E7=94=B0 Mobile: +1 (650) 798-9092 E-mail: hotpxless@gmail.com Computer Science Department Stanford University