From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier 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 11:59:18 -0500 Message-ID: References: <5125ADA9.3070603@cs.ucla.edu> <51283965.2020107@yandex.ru> <837glzkqvc.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361641203 3972 80.91.229.3 (23 Feb 2013 17:40:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2013 17:40:03 +0000 (UTC) Cc: Dmitry Gutov , 13743@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 18:40:25 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 1U9J59-0002Dh-Hq for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2013 18:40:19 +0100 Original-Received: from localhost ([::1]:41243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9J4p-0004fE-1Y for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Feb 2013 12:39:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9J4i-0004et-Lk for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 12:39:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9IRh-00010O-Qr for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 11:59:55 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9IRh-00010K-KU for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 11:59:33 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U9IT8-0004sH-1X for bug-gnu-emacs@gnu.org; Sat, 23 Feb 2013 12:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Feb 2013 17:01: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.136163885118720 (code B ref 13743); Sat, 23 Feb 2013 17:01:01 +0000 Original-Received: (at 13743) by debbugs.gnu.org; 23 Feb 2013 17:00:51 +0000 Original-Received: from localhost ([127.0.0.1]:45927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9ISw-0004rt-Uu for submit@debbugs.gnu.org; Sat, 23 Feb 2013 12:00:51 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:36085) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U9ISu-0004rm-Ri for 13743@debbugs.gnu.org; Sat, 23 Feb 2013 12:00:49 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFsoXXp/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFsoXXp/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="2040094" Original-Received: from 108-161-117-233.dsl.teksavvy.com (HELO pastel.home) ([108.161.117.233]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Feb 2013 11:59:18 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 6EE0C6BD82; Sat, 23 Feb 2013 11:59:18 -0500 (EST) In-Reply-To: <837glzkqvc.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 23 Feb 2013 17:10:47 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) 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:71715 Archived-At: > 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. Stefan === modified file 'src/textprop.c' --- src/textprop.c 2013-01-02 16:13:04 +0000 +++ src/textprop.c 2013-02-23 16:58:50 +0000 @@ -60,7 +60,7 @@ static Lisp_Object Qread_only; Lisp_Object Qminibuffer_prompt; -/* Sticky properties */ +/* Sticky properties. */ Lisp_Object Qfront_sticky, Qrear_nonsticky; /* If o1 is a cons whose cdr is a cons, return non-zero and set o2 to @@ -1145,9 +1145,16 @@ if (!i) return Qnil; + if (BUFFERP (object)) + modify_region (object, start, end); + s = XINT (start); len = XINT (end) - s; + /* Recompute `i' since modify_region may have performed indirectly + arbitrary modifications to the interval tree. */ + i = interval_of (s, object); + /* No need to protect OBJECT, because we GC only if it's a buffer, and live buffers are always protected. */ GCPRO1 (properties); @@ -1174,9 +1181,6 @@ } } - if (BUFFERP (object)) - modify_region (object, start, end); - /* We are at the beginning of interval I, with LEN chars to scan. */ for (;;) {