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: Mon, 25 Feb 2013 20:56:19 +0200 Message-ID: <83sj4ki5nw.fsf@gnu.org> References: <5125ADA9.3070603@cs.ucla.edu> <51283965.2020107@yandex.ru> <837glzkqvc.fsf@gnu.org> <83621ilvk9.fsf@gnu.org> <512A31A0.4040804@yandex.ru> <83ehg5k8xe.fsf@gnu.org> <512AFC18.4090504@yandex.ru> <83y5ecic2p.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1361818653 6031 80.91.229.3 (25 Feb 2013 18:57:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Feb 2013 18:57:33 +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 Mon Feb 25 19:57:53 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 1UA3FI-0003y3-QG for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Feb 2013 19:57:53 +0100 Original-Received: from localhost ([::1]:41735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UA3Ey-0001dF-5B for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Feb 2013 13:57:32 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UA3Es-0001bB-Sx for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2013 13:57:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UA3Eo-0002yV-5K for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2013 13:57:26 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UA3En-0002yI-V8 for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2013 13:57:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UA3GP-0000SA-UF for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2013 13:59: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: Mon, 25 Feb 2013 18:59: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.13618186921682 (code B ref 13743); Mon, 25 Feb 2013 18:59:01 +0000 Original-Received: (at 13743) by debbugs.gnu.org; 25 Feb 2013 18:58:12 +0000 Original-Received: from localhost ([127.0.0.1]:49896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UA3Fb-0000R5-FB for submit@debbugs.gnu.org; Mon, 25 Feb 2013 13:58:11 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:40885) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UA3FY-0000Qv-Rj for 13743@debbugs.gnu.org; Mon, 25 Feb 2013 13:58:10 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MIS00100HXEU100@a-mtaout21.012.net.il> for 13743@debbugs.gnu.org; Mon, 25 Feb 2013 20:56:26 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MIS001LOHY1GDF0@a-mtaout21.012.net.il>; Mon, 25 Feb 2013 20:56:26 +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:71792 Archived-At: > From: Stefan Monnier > Cc: dgutov@yandex.ru, 13743@debbugs.gnu.org > Date: Mon, 25 Feb 2013 13:29:57 -0500 > > turn on overwrite-mode and replace the char at point with itself: > sure enough the buffer is marked as modified. Since you know how things work internally in this case, I'm surprised that you bring this example. It is not analogous to what happens in the case in point. In the case in point, we didn't change anything at all, we just walked the interval tree and wound up discovering that no changes are needed. But the call to modify_region was issued before we made that discovery -- and that's the problem. By contrast, in overwrite-mode we actually make the change without trying to avoid it. > Along the same lines, try (setq t t) and watch how it complains that > we're trying to modify a read-only object, ... Feel free to fix this blunder. > > You can repeat the last 2 steps forever, the buffer always becomes > > modified. I don't see how this could be anything but a bug. Not a > > catastrophe, I agree, but a bug nonetheless. > > add-text-property is a mutation operation, like setq. Whether or not it > returns data about the "old state" doesn't make it less of > a side-effecting operation, in my eyes. If add-text-property was a black box, I might consider agreeing with you. But since it isn't, and its algorithm is glaringly clear, I don't. The algorithm clearly tries to avoid mutation when possible, it just didn't go far enough. > So, no I do not consider it to be a bug at all. Not even considering the fact that it causes redisplay do redundant work? If so, we will have to agree to disagree. > Try (add-text-properties 2 10 '(foo nil)) for another corner case: the > `foo' property was already nil (by default), and yet add-text-properties > claims that setting it to nil is a modification. I didn't say that what I fixed was the last bug. > >> And I don't think it's an important one here, since (as Dmitry points > >> out) the likely most common case (of having `start' be right at the > >> beginning of an interval object) didn't work anyway > > It does work now. More importantly, it fixed the original crash. > > I suspect it only works around the crash by optimizing away the call > to modify_region in the particular case you're testing. So you think I should install the followup I showed earlier? > >> and furthermore most calls to add-text-properties are likely to be > >> protected by inhibit-modification-hooks. > > I don't think inhibit-modification-hooks stops the file-locking prompt > > from being shown, does it? > > Well, I meant not just inhibit-modification-hooks but > with-silent-modifications (or a comparable set of let-bindings and > unwind-protect), which does prevent the prompt. Not with mmm-mode, it doesn't. If you repeat the original recipe for the crash, putting a breakpoint in filelock.c where it calls ask-user-about-lock, and type 'p' to the first prompt, you will get a second prompt, triggered by jit-lock, which does use with-silent-modifications, AFAICS. I didn't try to figure out why this happens.