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#13743: 24.2.93; Segmentation fault when trying to [s]teal a file opened elsewhere Date: Sat, 23 Feb 2013 20:44:06 +0200 Message-ID: <83621ilvk9.fsf@gnu.org> References: <5125ADA9.3070603@cs.ucla.edu> <51283965.2020107@yandex.ru> <837glzkqvc.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1361645090 5309 80.91.229.3 (23 Feb 2013 18:44:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2013 18:44:50 +0000 (UTC) Cc: dgutov@yandex.ru, 13743@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 19:45:09 2013 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 1U9K5m-0005t7-Ij for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2013 19:45:02 +0100 Original-Received: from localhost ([::1]:39339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9K5S-0005ow-3b for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2013 13:44:42 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9K5L-0005oO-Ir for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 13:44:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9K5J-0005Mu-62 for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 13:44:35 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9K5J-0005Mq-3F for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 13:44:33 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U9K6j-0007DZ-Sy for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 13:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Feb 2013 18:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13743 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13743-submit@debbugs.gnu.org id=B13743.136164515627735 (code B ref 13743); Sat, 23 Feb 2013 18:46:01 +0000 Original-Received: (at 13743) by debbugs.gnu.org; 23 Feb 2013 18:45:56 +0000 Original-Received: from localhost ([127.0.0.1]:45994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9K6e-0007DG-DH for submit@debbugs.gnu.org; Sat, 23 Feb 2013 13:45:56 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:44162) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9K6a-0007D7-K2 for 13743@debbugs.gnu.org; Sat, 23 Feb 2013 13:45:54 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MIO00D00RXDNU00@a-mtaout23.012.net.il> for 13743@debbugs.gnu.org; Sat, 23 Feb 2013 20:44:21 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MIO00DAOS1UJL60@a-mtaout23.012.net.il>; Sat, 23 Feb 2013 20:44:18 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il 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.x 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:71717 Archived-At: > From: Stefan Monnier > Cc: Dmitry Gutov , 13743@debbugs.gnu.org > Date: Sat, 23 Feb 2013 11:59:18 -0500 > > > I can fix this particular problem with this simple patch: > [...] > > However, I'm not sure this is the right or the best way. If it is, it > > will probably be prudent to add some protection against infinite > > recursion here. > > How 'bout moving the > > if (BUFFERP (object)) > modify_region (object, start, end); > > earlier in the function. Something like the patch below. This will (falsely, AFAIU) tell us that the region is about to be modified when we return at the point marked below: /* If we're not starting on an interval boundary, we have to split this interval. */ if (i->position != s) { /* If this interval already has the properties, we can skip it. */ if (interval_has_all_properties (properties, i)) { ptrdiff_t got = (LENGTH (i) - (s - i->position)); if (got >= len) RETURN_UNGCPRO (Qnil); <<<<<<<<<<<<<<<<<<<<<<<<<<< len -= got; i = next_interval (i); } else