From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.bugs Subject: bug#12426: 24.2.50; Emacs is closed unexpectedly after query-replace Date: Thu, 13 Sep 2012 07:01:48 +0400 Message-ID: <50514C9C.8010004@yandex.ru> References: <837grzw0ek.fsf@gnu.org> <83627jvzd8.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060402040000000504050802" X-Trace: ger.gmane.org 1347505339 11205 80.91.229.3 (13 Sep 2012 03:02:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Sep 2012 03:02:19 +0000 (UTC) Cc: 12426@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 13 05:02:22 2012 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 1TBzh6-0007Ko-Sq for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Sep 2012 05:02:21 +0200 Original-Received: from localhost ([::1]:36851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBzh2-0006nA-PC for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Sep 2012 23:02:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBzgz-0006mt-Po for bug-gnu-emacs@gnu.org; Wed, 12 Sep 2012 23:02:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBzgy-000249-RW for bug-gnu-emacs@gnu.org; Wed, 12 Sep 2012 23:02:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBzgy-000245-Ny for bug-gnu-emacs@gnu.org; Wed, 12 Sep 2012 23:02:12 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TBzhl-0000PO-Nx for bug-gnu-emacs@gnu.org; Wed, 12 Sep 2012 23:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Antipov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Sep 2012 03:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12426 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12426-submit@debbugs.gnu.org id=B12426.13475053641547 (code B ref 12426); Thu, 13 Sep 2012 03:03:01 +0000 Original-Received: (at 12426) by debbugs.gnu.org; 13 Sep 2012 03:02:44 +0000 Original-Received: from localhost ([127.0.0.1]:58294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TBzhT-0000Ot-Ot for submit@debbugs.gnu.org; Wed, 12 Sep 2012 23:02:44 -0400 Original-Received: from forward19.mail.yandex.net ([95.108.253.144]:40765) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TBzhQ-0000Ok-C0 for 12426@debbugs.gnu.org; Wed, 12 Sep 2012 23:02:42 -0400 Original-Received: from smtp18.mail.yandex.net (smtp18.mail.yandex.net [95.108.252.18]) by forward19.mail.yandex.net (Yandex) with ESMTP id 6FE4E1121218; Thu, 13 Sep 2012 07:01:49 +0400 (MSK) Original-Received: from smtp18.mail.yandex.net (localhost [127.0.0.1]) by smtp18.mail.yandex.net (Yandex) with ESMTP id 3D64118A0141; Thu, 13 Sep 2012 07:01:49 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp18.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 1mHq0Ljg-1nHGD4jW; Thu, 13 Sep 2012 07:01:49 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1347505309; bh=13/qXPzkwztgCFXkGokx1hNAh9/3he9rQab8PMfwCvg=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=ZWtAIsXQnutyK+yEqpqEMba9jwWBjmdRUitpUkOJgIjUymM0TFwHwLh6wX1cncv1T Y6EI2crVvch823EI3uLfnWQdgxzAOJNhKfwmvydhN/2to3iRBs7QIkRA6h7Lw2XrjH dwFc/BFC3+LZLyxRoDwqnq4g+o+LSUiZPSXbyGok= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 In-Reply-To: <83627jvzd8.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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:64218 Archived-At: This is a multi-part message in MIME format. --------------060402040000000504050802 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 09/12/2012 11:02 PM, Eli Zaretskii wrote: > The reason for the assertion violation is the assertion in > marker_position: > > eassert (BUF_BEG (buf) <= m->charpos && m->charpos <= BUF_Z (buf)); > > This was introduced recently by Dmitry, in revision 108906. A similar > assertion was added to marker_byte_position. > > Dmitry, why did you add them? Who said that a marker cannot > legitimately have a position outside of its buffer's range of > character positions? IIUC marker can have out-of-buffer-range position, but only somewhere in the middle of an insertion/deletion/replace operation; out-of-range position should be detected and immediately fixed by adjust_markers_for_{delete,insert,replace}. BTW, look at this code from replace_range: /* Adjust the overlay center as needed. This must be done after adjusting the markers that bound the overlays. */ adjust_overlays_for_delete (from, nchars_del); adjust_overlays_for_insert (from, inschars); /* Adjust markers for the deletion and the insertion. */ if (markers) adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, inschars, outgoing_insbytes); The comment explicitly says that overlays should be adjusted _after_ markers, but the code adjusts overlays and then markers :-(. Since an overlays are bounded by markers, the comment looks correct but the code isn't. I suppose that the code snippets above should be swapped. Dmitry --------------060402040000000504050802 Content-Type: text/plain; charset=UTF-8; name="adjust.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="adjust.patch" PT09IG1vZGlmaWVkIGZpbGUgJ3NyYy9pbnNkZWwuYycKLS0tIHNyYy9pbnNkZWwuYwkyMDEy LTA5LTExIDA0OjIyOjAzICswMDAwCisrKyBzcmMvaW5zZGVsLmMJMjAxMi0wOS0xMyAwMjo0 NzozNiArMDAwMApAQCAtMTM5NCwxNiArMTM5NCwxNiBAQAogCiAgIGVhc3NlcnQgKEdQVCA8 PSBHUFRfQllURSk7CiAKLSAgLyogQWRqdXN0IHRoZSBvdmVybGF5IGNlbnRlciBhcyBuZWVk ZWQuICBUaGlzIG11c3QgYmUgZG9uZSBhZnRlcgotICAgICBhZGp1c3RpbmcgdGhlIG1hcmtl cnMgdGhhdCBib3VuZCB0aGUgb3ZlcmxheXMuICAqLwotICBhZGp1c3Rfb3ZlcmxheXNfZm9y X2RlbGV0ZSAoZnJvbSwgbmNoYXJzX2RlbCk7Ci0gIGFkanVzdF9vdmVybGF5c19mb3JfaW5z ZXJ0IChmcm9tLCBpbnNjaGFycyk7Ci0KICAgLyogQWRqdXN0IG1hcmtlcnMgZm9yIHRoZSBk ZWxldGlvbiBhbmQgdGhlIGluc2VydGlvbi4gICovCiAgIGlmIChtYXJrZXJzKQogICAgIGFk anVzdF9tYXJrZXJzX2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