From unknown Mon Jun 23 11:24:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8219 <8219@debbugs.gnu.org> To: bug#8219 <8219@debbugs.gnu.org> Subject: Status: 23.3; Crash in indirect buffer Reply-To: bug#8219 <8219@debbugs.gnu.org> Date: Mon, 23 Jun 2025 18:24:56 +0000 retitle 8219 23.3; Crash in indirect buffer reassign 8219 emacs submitter 8219 Chong Yidong severity 8219 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 15:24:55 2011 Received: (at submit) by debbugs.gnu.org; 10 Mar 2011 20:24:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxmPn-0001Ck-AI for submit@debbugs.gnu.org; Thu, 10 Mar 2011 15:24:55 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxmPl-0001CX-1c for submit@debbugs.gnu.org; Thu, 10 Mar 2011 15:24:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxmPe-0002U2-RY for submit@debbugs.gnu.org; Thu, 10 Mar 2011 15:24:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:35416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxmPe-0002Ty-Md for submit@debbugs.gnu.org; Thu, 10 Mar 2011 15:24:46 -0500 Received: from [140.186.70.92] (port=43706 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxmPd-00011s-FR for bug-gnu-emacs@gnu.org; Thu, 10 Mar 2011 15:24:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxmPb-0002T6-Gi for bug-gnu-emacs@gnu.org; Thu, 10 Mar 2011 15:24:45 -0500 Received: from vm-emlprdomr-04.its.yale.edu ([130.132.50.145]:46576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxmPb-0002Sd-Ev for bug-gnu-emacs@gnu.org; Thu, 10 Mar 2011 15:24:43 -0500 Received: from furball (dhcp128036014208.central.yale.edu [128.36.14.208]) (authenticated bits=0) by vm-emlprdomr-04.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2AKOfuk020935 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 10 Mar 2011 15:24:41 -0500 Received: by furball (Postfix, from userid 1000) id 87938160401; Thu, 10 Mar 2011 15:24:41 -0500 (EST) From: Chong Yidong To: bug-gnu-emacs@gnu.org Subject: 23.3; Crash in indirect buffer Date: Thu, 10 Mar 2011 15:24:41 -0500 Message-ID: <87ei6e206u.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.145 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) Just came across this; it is present in (at least) 23.2, and in trunk. I haven't had time to debug further; any help welcome. The backtrace is from trunk. emacs -Q M-< M-x clone-indirect-buffer RET C-n C-k C-x o C-k => abort #0 abort () at emacs.c:372 #1 0x0000000000646ba0 in find_interval (tree=0xc569e0, position=78) at intervals.c:635 #2 0x0000000000649c9c in get_property_and_range (pos=78, prop=12679682, val=0x7fffffffacd8, start=0x7ffffffface8, end=0x7ffffffface0, object=22411973) at intervals.c:2263 #3 0x0000000000651631 in find_composition (pos=78, limit=-1, start=0x7ffffffface8, end=0x7ffffffface0, prop=0x7fffffffacd8, object=22411973) at composite.c:430 #4 0x0000000000448290 in check_point_in_composition (prev_buf=0x155fac0, prev_pt=78, buf=0x155fac0, pt=2) at xdisp.c:11311 #5 0x0000000000448857 in reconsider_clip_changes (w=0x1564480, b=0x155fac0) at xdisp.c:11358 #6 0x000000000044f0d7 in redisplay_window (window=22430853, just_this_one_p=0) at xdisp.c:13715 #7 0x000000000044addc in redisplay_window_0 (window=22430853) at xdisp.c:12362 #8 0x00000000005dc1dc in internal_condition_case_1 ( bfun=0x44ad9d , arg=22430853, handlers=12412566, hfun=0x44ad6e ) at eval.c:1453 #9 0x000000000044ad4f in redisplay_windows (window=22430853) at xdisp.c:12342 #10 0x000000000044ad09 in redisplay_windows (window=22430309) at xdisp.c:12336 #11 0x0000000000449e14 in redisplay_internal (preserve_echo_area=0) at xdisp.c:11919 #12 0x0000000000447cff in redisplay () at xdisp.c:11139 #13 0x00000000005419ca in read_char (commandflag=1, nmaps=2, maps=0x7fffffffdae0, prev_event=12442194, used_mouse_menu=0x7fffffffddb8, end_time=0x0) at keyboard.c:2357 #14 0x000000000054f450 in read_key_sequence (keybuf=0x7fffffffde20, bufsize=30, prompt=12442194, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9193 #15 0x000000000053fbae in command_loop_1 () at keyboard.c:1409 #16 0x00000000005dc067 in internal_condition_case ( bfun=0x53f7f3 , handlers=12494210, hfun=0x53f0d8 ) at eval.c:1408 #17 0x000000000053f4f4 in command_loop_2 (ignore=12442194) at keyboard.c:1129 #18 0x00000000005dba31 in internal_catch (tag=12490226, func=0x53f4ce , arg=12442194) at eval.c:1152 #19 0x000000000053f4a7 in command_loop () at keyboard.c:1108 #20 0x000000000053ec0f in recursive_edit_1 () at keyboard.c:731 #21 0x000000000053edc2 in Frecursive_edit () at keyboard.c:793 #22 0x000000000053d0e8 in main (argc=2, argv=0x7fffffffe728) at emacs.c:1684 In GNU Emacs 24.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of 2011-03-10 on furball Windowing system distributor `The X.Org Foundation', version 11.0.10706000 configured using `configure 'CC=gcc' 'CFLAGS=-g'' From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 15:56:14 2011 Received: (at 8219) by debbugs.gnu.org; 10 Mar 2011 20:56:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pxmu5-0002g5-ST for submit@debbugs.gnu.org; Thu, 10 Mar 2011 15:56:14 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pxmu3-0002fw-7C for 8219@debbugs.gnu.org; Thu, 10 Mar 2011 15:56:11 -0500 Received: from localhost ([127.0.0.1]:36706) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pxmtx-0001Vv-Q0; Thu, 10 Mar 2011 15:56:05 -0500 From: Glenn Morris To: Chong Yidong Subject: Re: bug#8219: 23.3; Crash in indirect buffer References: <87ei6e206u.fsf@stupidchicken.com> X-Spook: BATF bemd PLO Serbian oil enforcers Marxist White House X-Ran: "BZ:.6op"}"p|j7<.%;?dmrjS(*oz.gI*]llQ(;:[B;llHEK@r&`<{[EX|y+d=DZpr/N=" X-Hue: green X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 10 Mar 2011 15:56:05 -0500 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) Same as http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1242 ? From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 16:56:42 2011 Received: (at 8219) by debbugs.gnu.org; 10 Mar 2011 21:56:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxnqY-00044w-OU for submit@debbugs.gnu.org; Thu, 10 Mar 2011 16:56:42 -0500 Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxnqX-00044l-Ow for 8219@debbugs.gnu.org; Thu, 10 Mar 2011 16:56:38 -0500 Received: from furball (dhcp128036014208.central.yale.edu [128.36.14.208]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2ALuVkd022720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 10 Mar 2011 16:56:31 -0500 Received: by furball (Postfix, from userid 1000) id 4E13D160401; Thu, 10 Mar 2011 16:56:32 -0500 (EST) From: Chong Yidong To: Glenn Morris Subject: Re: bug#8219: 23.3; Crash in indirect buffer References: <87ei6e206u.fsf@stupidchicken.com> Date: Thu, 10 Mar 2011 16:56:32 -0500 In-Reply-To: (Glenn Morris's message of "Thu, 10 Mar 2011 15:56:05 -0500") Message-ID: <87oc5iy6zz.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Glenn Morris writes: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1242 I guess we can assume this is the same bug. So, now we have a reproducible recipe. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 17:24:50 2011 Received: (at control) by debbugs.gnu.org; 10 Mar 2011 22:24:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxoHq-0004hS-8V for submit@debbugs.gnu.org; Thu, 10 Mar 2011 17:24:50 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PxoHp-0004hC-DI for control@debbugs.gnu.org; Thu, 10 Mar 2011 17:24:49 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1PxoHk-00066M-6u for control@debbugs.gnu.org; Thu, 10 Mar 2011 17:24:44 -0500 Date: Thu, 10 Mar 2011 17:24:44 -0500 Message-Id: Subject: control message for bug 8219 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) merge 1242 8219 From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 11 14:48:30 2011 Received: (at 8219) by debbugs.gnu.org; 11 Mar 2011 19:48:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Py8K6-00041z-0a for submit@debbugs.gnu.org; Fri, 11 Mar 2011 14:48:30 -0500 Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Py8K3-00041o-I3 for 8219@debbugs.gnu.org; Fri, 11 Mar 2011 14:48:28 -0500 Received: from furball (dhcp128036014143.central.yale.edu [128.36.14.143]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2BJmL4m007519 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 11 Mar 2011 14:48:21 -0500 Received: by furball (Postfix, from userid 1000) id A19181603F0; Fri, 11 Mar 2011 14:48:21 -0500 (EST) From: Chong Yidong To: emacs-devel@gnu.org Subject: Effect of deletions on indirect buffers (Bug#8219) Date: Fri, 11 Mar 2011 14:48:21 -0500 Message-ID: <877hc5bfqy.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Indirect bufffers are allowed to have their own values of point, BUF_BEGV, and BUF_ZV (indeed, that's one of their roles). Their other attributes inherit from the base buffer, e.g. #define BUF_Z(buf) ((buf)->text->z) where `text' points to the base buffer's text object. Now consider what happens when a deletion is performed in buffer A, which is the base buffer for an indirect buffer B. It appears that the responsible functions, such as del_range_2, only update the attributes of buffer A, making no effort to update buffer B. Hence, in the aftermath of a deletion, buffer B's values of PT (and BUF_BEGV and BUF_ZV) can be larger than BUF_ZV. This is the proximate cause of the crash in Bug#8219: there, we have if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf) && find_composition (prev_pt, -1, &start, &end, &prop, buffer) and find_composition aborts because prev_pt is larger than the size of the buffer. I'm not sure what the best solution is. The narrowest fix is to change find_composition, and the functions it calls, so that it does not abort when supplied with a position that's beyond BUF_Z. This might be the best approach for the emacs-23 branch. However, I suspect that we have other places in the code that assumes that if a point is smaller than BUF_ZV, it's necessarily smaller than BUF_Z---which we now see if not that case. So, a more comprehensive fix is needed for the trunk. Any thoughts? From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 11 15:08:00 2011 Received: (at 8219) by debbugs.gnu.org; 11 Mar 2011 20:08:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Py8cy-0004Rg-IW for submit@debbugs.gnu.org; Fri, 11 Mar 2011 15:08:00 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Py8cv-0004RS-IZ for 8219@debbugs.gnu.org; Fri, 11 Mar 2011 15:07:58 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LHW00H00SJB1Y00@a-mtaout22.012.net.il> for 8219@debbugs.gnu.org; Fri, 11 Mar 2011 22:07:51 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.58.59]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LHW00F9KT92OPQ0@a-mtaout22.012.net.il>; Fri, 11 Mar 2011 22:07:51 +0200 (IST) Date: Fri, 11 Mar 2011 22:07:54 +0200 From: Eli Zaretskii Subject: Re: Effect of deletions on indirect buffers (Bug#8219) In-reply-to: <877hc5bfqy.fsf@stupidchicken.com> X-012-Sender: halo1@inter.net.il To: Chong Yidong Message-id: <838vwlto85.fsf@gnu.org> References: <877hc5bfqy.fsf@stupidchicken.com> X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > From: Chong Yidong > Date: Fri, 11 Mar 2011 14:48:21 -0500 > Cc: 8219@debbugs.gnu.org > > Now consider what happens when a deletion is performed in buffer A, > which is the base buffer for an indirect buffer B. It appears that the > responsible functions, such as del_range_2, only update the attributes > of buffer A, making no effort to update buffer B. > > Hence, in the aftermath of a deletion, buffer B's values of PT (and > BUF_BEGV and BUF_ZV) can be larger than BUF_ZV. Isn't that a bug, right there? Why doesn't del_range_2 update the indirect buffer (B) as well, when deletion removes text so that its PT becomes invalid? The ELisp manual says: The text of the indirect buffer is always identical to the text of its base buffer; changes made by editing either one are visible immediately in the other. This includes the text properties as well as the characters themselves. In all other respects, the indirect buffer and its base buffer are completely separate. They have different names, independent values of point, independent narrowing, independent markers and overlays (though inserting or deleting text in either buffer relocates the markers and overlays for both), [...] This makes a lot of sense, but your description seems to point out that the implementation does not behave according to the docs: if markers are (or should be) relocated in sync as result of insertion and deletion, the same should happen with PT, BUF_BEGV, etc. Am I missing something? If not, the solution is to update the attributes of the indirect buffer so as to preserve the invariants, like PT <= BUF_Z etc. > However, I suspect that we have other places in the code that assumes > that if a point is smaller than BUF_ZV, it's necessarily smaller than > BUF_Z It is madness IMO to allow BUF_Z and BUF_ZV be out of sync. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 11 15:59:07 2011 Received: (at 8219) by debbugs.gnu.org; 11 Mar 2011 20:59:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Py9QR-0005Yo-0V for submit@debbugs.gnu.org; Fri, 11 Mar 2011 15:59:07 -0500 Received: from vm-emlprdomr-04.its.yale.edu ([130.132.50.145]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Py9QN-0005YH-4N for 8219@debbugs.gnu.org; Fri, 11 Mar 2011 15:59:04 -0500 Received: from furball (dhcp128036014143.central.yale.edu [128.36.14.143]) (authenticated bits=0) by vm-emlprdomr-04.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2BKwv8u031966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 11 Mar 2011 15:58:57 -0500 Received: by furball (Postfix, from userid 1000) id 7096F1605F5; Fri, 11 Mar 2011 15:58:57 -0500 (EST) From: Chong Yidong To: Eli Zaretskii Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> Date: Fri, 11 Mar 2011 15:58:57 -0500 In-Reply-To: <838vwlto85.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 11 Mar 2011 22:07:54 +0200") Message-ID: <874o79nzla.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.145 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Eli Zaretskii writes: >> Hence, in the aftermath of a deletion, buffer B's values of PT (and >> BUF_BEGV and BUF_ZV) can be larger than BUF_ZV. > > Isn't that a bug, right there? Why doesn't del_range_2 update the > indirect buffer (B) as well, when deletion removes text so that its PT > becomes invalid? This is not currently easy. We don't keep track of indirect buffers (looping over the buffer list each time we do a deletion would be rather inefficient), so this would need some new members of the buffer struct. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 11 18:19:35 2011 Received: (at 8219) by debbugs.gnu.org; 11 Mar 2011 23:19:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyBcM-0000IC-HW for submit@debbugs.gnu.org; Fri, 11 Mar 2011 18:19:34 -0500 Received: from tomts36-srv.bellnexxia.net ([209.226.175.93]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyBcK-0000I1-Jt for 8219@debbugs.gnu.org; Fri, 11 Mar 2011 18:19:33 -0500 Received: from toip3.srvr.bell.ca ([209.226.175.86]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20110311231926.IRDQ2196.tomts36-srv.bellnexxia.net@toip3.srvr.bell.ca> for <8219@debbugs.gnu.org>; Fri, 11 Mar 2011 18:19:26 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAIY7ek1GHsU+/2dsb2JhbACmN3jCRYViBIUp Received: from bas1-montreal07-1176421694.dsl.bell.ca (HELO ceviche.home) ([70.30.197.62]) by toip3.srvr.bell.ca with ESMTP; 11 Mar 2011 18:19:26 -0500 Received: by ceviche.home (Postfix, from userid 20848) id C8E49660C9; Fri, 11 Mar 2011 18:19:25 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: Effect of deletions on indirect buffers (Bug#8219) Message-ID: References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> Date: Fri, 11 Mar 2011 18:19:25 -0500 In-Reply-To: <838vwlto85.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 11 Mar 2011 22:07:54 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 8219 Cc: Chong Yidong , 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) > This makes a lot of sense, but your description seems to point out > that the implementation does not behave according to the docs: if > markers are (or should be) relocated in sync as result of insertion > and deletion, the same should happen with PT, BUF_BEGV, etc. Actually, indirect buffers keep their point and narrowing in real markers. So when they get "active" the BUF_PT, BUF_ZV, etc... get updated, but until that time, BUF_PT and friends may hold invalid data. I.e. any place where we use BUF_PT on something else than current_buffer, we have a bug waiting to happen unless we know for sure that that buffer is not indirect. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 12 03:15:17 2011 Received: (at 8219) by debbugs.gnu.org; 12 Mar 2011 08:15:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyJym-0003Yb-NK for submit@debbugs.gnu.org; Sat, 12 Mar 2011 03:15:17 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyJyk-0003YO-PJ for 8219@debbugs.gnu.org; Sat, 12 Mar 2011 03:15:15 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LHX00M00QPJTJ00@a-mtaout20.012.net.il> for 8219@debbugs.gnu.org; Sat, 12 Mar 2011 10:15:06 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.58.59]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LHX00M0HQX0KF50@a-mtaout20.012.net.il>; Sat, 12 Mar 2011 10:15:01 +0200 (IST) Date: Sat, 12 Mar 2011 10:15:05 +0200 From: Eli Zaretskii Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) In-reply-to: <874o79nzla.fsf@stupidchicken.com> X-012-Sender: halo1@inter.net.il To: Chong Yidong Message-id: <834o78u54m.fsf@gnu.org> References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <874o79nzla.fsf@stupidchicken.com> X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > From: Chong Yidong > Cc: 8219@debbugs.gnu.org, emacs-devel@gnu.org > Date: Fri, 11 Mar 2011 15:58:57 -0500 > > Eli Zaretskii writes: > > >> Hence, in the aftermath of a deletion, buffer B's values of PT (and > >> BUF_BEGV and BUF_ZV) can be larger than BUF_ZV. > > > > Isn't that a bug, right there? Why doesn't del_range_2 update the > > indirect buffer (B) as well, when deletion removes text so that its PT > > becomes invalid? > > This is not currently easy. We don't keep track of indirect buffers > (looping over the buffer list each time we do a deletion would be rather > inefficient), so this would need some new members of the buffer struct. We could do that lazily, whenever something (including redisplay) is done on a buffer that happens to be an indirect buffer. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 12 04:01:50 2011 Received: (at 8219) by debbugs.gnu.org; 12 Mar 2011 09:01:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyKhp-0004ku-Vp for submit@debbugs.gnu.org; Sat, 12 Mar 2011 04:01:50 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyKhn-0004kg-4D for 8219@debbugs.gnu.org; Sat, 12 Mar 2011 04:01:48 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LHX00400SW7NH00@a-mtaout23.012.net.il> for 8219@debbugs.gnu.org; Sat, 12 Mar 2011 11:01:41 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.58.59]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LHX004QDT2RN210@a-mtaout23.012.net.il>; Sat, 12 Mar 2011 11:01:41 +0200 (IST) Date: Sat, 12 Mar 2011 11:01:45 +0200 From: Eli Zaretskii Subject: Re: Effect of deletions on indirect buffers (Bug#8219) In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83wrk4soee.fsf@gnu.org> References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 8219 Cc: cyd@stupidchicken.com, 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.7 (-) > From: Stefan Monnier > Cc: Chong Yidong , 8219@debbugs.gnu.org, emacs-devel@gnu.org > Date: Fri, 11 Mar 2011 18:19:25 -0500 > > I.e. any place where we use BUF_PT on something else than > current_buffer, we have a bug waiting to happen unless we know for sure > that that buffer is not indirect. It follows that BUF_PT, when used on other than the current buffer should update PT if necessary, if that buffer is an indirect buffer, before returning the value. And the same with BUF_BEGV, BUF_ZV, etc. Right? From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 12 15:47:14 2011 Received: (at 8219) by debbugs.gnu.org; 12 Mar 2011 20:47:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyViU-0004F2-Lk for submit@debbugs.gnu.org; Sat, 12 Mar 2011 15:47:14 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyViR-0004Ep-Rl for 8219@debbugs.gnu.org; Sat, 12 Mar 2011 15:47:12 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAM9qe03O+IG+/2dsb2JhbACmQnjAGoViBIUrkCE X-IronPort-AV: E=Sophos;i="4.62,308,1297054800"; d="scan'208";a="96051585" Received: from 206-248-129-190.dsl.teksavvy.com (HELO pastel.home) ([206.248.129.190]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 12 Mar 2011 15:47:06 -0500 Received: by pastel.home (Postfix, from userid 20848) id D9E1259047; Sat, 12 Mar 2011 15:47:05 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: Effect of deletions on indirect buffers (Bug#8219) Message-ID: References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <83wrk4soee.fsf@gnu.org> Date: Sat, 12 Mar 2011 15:47:05 -0500 In-Reply-To: <83wrk4soee.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 12 Mar 2011 11:01:45 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8219 Cc: cyd@stupidchicken.com, 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > It follows that BUF_PT, when used on other than the current buffer > should update PT if necessary, if that buffer is an indirect buffer, > before returning the value. And the same with BUF_BEGV, BUF_ZV, etc. > Right? Yes. At least that was my conclusion last time we bumped into such a bug. I even added a comment in buffer.h about it: /* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: on indirect (or base) buffers, that value is only correct if that buffer is the current_buffer, or if the buffer's text hasn't been modified (via an indirect buffer) since it was last current. */ Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 13 12:31:07 2011 Received: (at 8219) by debbugs.gnu.org; 13 Mar 2011 16:31:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyoCA-00068u-OZ for submit@debbugs.gnu.org; Sun, 13 Mar 2011 12:31:07 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PyoC9-00068R-10 for 8219@debbugs.gnu.org; Sun, 13 Mar 2011 12:31:05 -0400 Received: from cyd by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1PyoC3-0005lc-Gn; Sun, 13 Mar 2011 12:30:59 -0400 From: Chong Yidong To: Stefan Monnier Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <83wrk4soee.fsf@gnu.org> Date: Sun, 13 Mar 2011 12:30:59 -0400 In-Reply-To: (Stefan Monnier's message of "Sat, 12 Mar 2011 15:47:05 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: 8219 Cc: Eli Zaretskii , 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) Stefan Monnier writes: > Yes. At least that was my conclusion last time we bumped into such > a bug. I even added a comment in buffer.h about it: > > /* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: > on indirect (or base) buffers, that value is only correct if that buffer > is the current_buffer, or if the buffer's text hasn't been modified (via > an indirect buffer) since it was last current. */ I think we should do away with the BUF_BEGV and related macros. Let the code in buffer.c manipulate the buffer->begv members directly; and the usage in other parts of Emacs can be replaced with buf_begv() functions that will update begv if necessary, and return the corrected result. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 13 13:09:53 2011 Received: (at 8219) by debbugs.gnu.org; 13 Mar 2011 17:09:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pyong-00073o-Kh for submit@debbugs.gnu.org; Sun, 13 Mar 2011 13:09:52 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pyonf-00073d-3K for 8219@debbugs.gnu.org; Sun, 13 Mar 2011 13:09:51 -0400 Received: from cyd by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1PyonZ-0007S2-Hc; Sun, 13 Mar 2011 13:09:45 -0400 From: Chong Yidong To: Stefan Monnier Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <83wrk4soee.fsf@gnu.org> Date: Sun, 13 Mar 2011 13:09:45 -0400 In-Reply-To: (Chong Yidong's message of "Sun, 13 Mar 2011 12:30:59 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: 8219 Cc: Eli Zaretskii , 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) Chong Yidong writes: > I think we should do away with the BUF_BEGV and related macros. Let the > code in buffer.c manipulate the buffer->begv members directly; and the > usage in other parts of Emacs can be replaced with buf_begv() functions > that will update begv if necessary, and return the corrected result. Or rather, these functions should consult the pt_marker, begv_marker and zv_marker markers instead of accessing begv etc directly. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 13 18:29:08 2011 Received: (at 8219) by debbugs.gnu.org; 13 Mar 2011 22:29:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pytmd-0005f4-V4 for submit@debbugs.gnu.org; Sun, 13 Mar 2011 18:29:08 -0400 Received: from vm-emlprdomr-03.its.yale.edu ([130.132.50.144]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pytmc-0005ec-Ep for 8219@debbugs.gnu.org; Sun, 13 Mar 2011 18:29:06 -0400 Received: from furball ([64.134.240.221]) (authenticated bits=0) by vm-emlprdomr-03.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2DMT0O8009193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 13 Mar 2011 18:29:00 -0400 Received: by furball (Postfix, from userid 1000) id EC45516066A; Sun, 13 Mar 2011 18:29:01 -0400 (EDT) From: Chong Yidong To: Stefan Monnier Subject: Re: Effect of deletions on indirect buffers (Bug#8219) References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <83wrk4soee.fsf@gnu.org> Date: Sun, 13 Mar 2011 18:29:01 -0400 In-Reply-To: (Stefan Monnier's message of "Sat, 12 Mar 2011 15:47:05 -0500") Message-ID: <87wrk2vemq.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.144 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 8219 Cc: Eli Zaretskii , 8219@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: > /* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: > on indirect (or base) buffers, that value is only correct if that buffer > is the current_buffer, or if the buffer's text hasn't been modified (via > an indirect buffer) since it was last current. */ OK, I've committed a fix to trunk. Instead of doing away with the BUF_* macros, I reworked them to handle the indirect buffer case properly. This means they can no longer be used in `BUF_PT (foo) = bar' assignment statements, so I've changed the callers that used them this way. Not sure if the patch is appropriate for the emacs-23 branch, though. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 13 22:42:28 2011 Received: (at 8219) by debbugs.gnu.org; 14 Mar 2011 02:42:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pyxjo-0002mA-9W for submit@debbugs.gnu.org; Sun, 13 Mar 2011 22:42:28 -0400 Received: from mail-qw0-f44.google.com ([209.85.216.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pyxjm-0002ly-Mk for 8219@debbugs.gnu.org; Sun, 13 Mar 2011 22:42:27 -0400 Received: by qwg5 with SMTP id 5so928658qwg.3 for <8219@debbugs.gnu.org>; Sun, 13 Mar 2011 19:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=EwFvxAaZIvo2pt5pJzJas+l2XlTYE69H5vzt2Wjany8=; b=YgkPf4FefTIK+mfoyupKZe5LwXzjL3XWQAn4qTQyoRXKr3W44xWV00UBnMlB91fjPZ 2Y+6y4eWvK7UbPl8QsCsqCLsXgPiwOvtI8AjKMIo++LMt09FjlTMgfFur0IecNGrBpHj +Tg6bUYAdbfI1SrzH1NSKjNd4ziw++QJ6R5OA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=A7XPwuid/szXTeD1kizAX4D2iLc0U8rHKayL38BmpwuAVhMpaoDN1t5WMG9MmeTwTT auLlVzfYN8SN2c7fqfcrA9tvvcZaz4T1EoCEPOe3UIvsaVkcDnEBvUBfi59Ve5qXIZlT /NacAz8eVWIVjHFaoy4t/IBq8cosowim3D+Ps= Received: by 10.229.10.12 with SMTP id n12mr721258qcn.219.1300070541122; Sun, 13 Mar 2011 19:42:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.74.212 with HTTP; Sun, 13 Mar 2011 19:41:41 -0700 (PDT) In-Reply-To: <87wrk2vemq.fsf@stupidchicken.com> References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <83wrk4soee.fsf@gnu.org> <87wrk2vemq.fsf@stupidchicken.com> From: Juanma Barranquero Date: Mon, 14 Mar 2011 03:41:41 +0100 Message-ID: Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) To: Chong Yidong Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org, Stefan Monnier , emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) > OK, I've committed a fix to trunk. =C2=A0Instead of doing away with the B= UF_* > macros, I reworked them to handle the indirect buffer case properly. > This means they can no longer be used in `BUF_PT (foo) =3D bar' assignmen= t > statements, so I've changed the callers that used them this way. emacs -Q --eval '(clone-indirect-buffer "clone" nil)' buffer.c:614: Emacs fatal error: assertion failed: NILP (BVAR (b, begv_mark= er)) Breakpoint 1, w32_abort () at w32fns.c:7208 7208 button =3D MessageBox (NULL, (gdb) bt #0 w32_abort () at w32fns.c:7208 #1 0x01047867 in die (msg=3D0x1590744 "assertion failed: NILP (BVAR (b, begv_marker))", file=3D0x158f518 "buffer.c", line=3D614) at alloc.c:6101 #2 0x010caa80 in Fmake_indirect_buffer (base_buffer=3D52342789, name=3D54741601, clone=3D52303922) at buffer.c:614 #3 0x0103beb5 in Ffuncall (nargs=3D4, args=3D0x88f0c0) at eval.c:2849 #4 0x01142a8c in Fbyte_code (bytestr=3D20838137, vector=3D20838245, maxdepth=3D16) at bytecode.c:689 #5 0x0103cbea in funcall_lambda (fun=3D20838093, nargs=3D2, arg_vector=3D0x88f260) at eval.c:3028 #6 0x0103c620 in apply_lambda (fun=3D20838093, args=3D57330886, eval_flag=3D1) at eval.c:2954 #7 0x0103a2bc in Feval (form=3D57330894) at eval.c:2296 #8 0x0103bd75 in Ffuncall (nargs=3D2, args=3D0x88f4b0) at eval.c:2842 #9 0x01142a8c in Fbyte_code (bytestr=3D20645329, vector=3D20645821, maxdepth=3D40) at bytecode.c:689 #10 0x0103cbea in funcall_lambda (fun=3D20645301, nargs=3D1, arg_vector=3D0x88f704) at eval.c:3028 #11 0x0103c2fc in Ffuncall (nargs=3D2, args=3D0x88f700) at eval.c:2891 #12 0x01142a8c in Fbyte_code (bytestr=3D20627337, vector=3D20628333, maxdepth=3D28) at bytecode.c:689 #13 0x0103cbea in funcall_lambda (fun=3D20627317, nargs=3D0, arg_vector=3D0x88f944) at eval.c:3028 #14 0x0103c2fc in Ffuncall (nargs=3D1, args=3D0x88f940) at eval.c:2891 #15 0x01142a8c in Fbyte_code (bytestr=3D20623889, vector=3D20624101, maxdepth=3D24) at bytecode.c:689 #16 0x0103cbea in funcall_lambda (fun=3D20623869, nargs=3D0, arg_vector=3D0x88faf0) at eval.c:3028 #17 0x0103c620 in apply_lambda (fun=3D20623869, args=3D52303898, eval_flag=3D1) at eval.c:2954 #18 0x0103a2bc in Feval (form=3D52791574) at eval.c:2296 #19 0x0100537b in top_level_2 () at keyboard.c:1138 #20 0x010378f4 in internal_condition_case (bfun=3D0x1005368 , handlers=3D52357530, hfun=3D0x1004e81 ) at eval.c:1408 #21 0x010053ad in top_level_1 (ignore=3D52303898) at keyboard.c:1146 #22 0x01037313 in internal_catch (tag=3D52355626, func=3D0x100537d , arg=3D52303898) at eval.c:1152 #23 0x010052f1 in command_loop () at keyboard.c:1101 #24 0x01004573 in recursive_edit_1 () at keyboard.c:731 #25 0x01004a97 in Frecursive_edit () at keyboard.c:793 #26 0x01002797 in main (argc=3D4, argv=3D0xca2da8) at emacs.c:1684 Lisp Backtrace: "make-indirect-buffer" (0x88f0c4) "clone-indirect-buffer" (0x88f260) "eval" (0x88f4b4) "command-line-1" (0x88f704) "command-line" (0x88f944) "normal-top-level" (0x88faf0) From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 12:18:52 2011 Received: (at 8219) by debbugs.gnu.org; 14 Mar 2011 16:18:52 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzATs-0000uB-5M for submit@debbugs.gnu.org; Mon, 14 Mar 2011 12:18:52 -0400 Received: from vm-emlprdomr-04.its.yale.edu ([130.132.50.145]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzATp-0000tu-V4 for 8219@debbugs.gnu.org; Mon, 14 Mar 2011 12:18:50 -0400 Received: from furball (dhcp128036014146.central.yale.edu [128.36.14.146]) (authenticated bits=0) by vm-emlprdomr-04.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2EGIijY029869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 14 Mar 2011 12:18:44 -0400 Received: by furball (Postfix, from userid 1000) id 05B7016066A; Mon, 14 Mar 2011 12:18:43 -0400 (EDT) From: Chong Yidong To: Juanma Barranquero Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) References: <877hc5bfqy.fsf@stupidchicken.com> <838vwlto85.fsf@gnu.org> <83wrk4soee.fsf@gnu.org> <87wrk2vemq.fsf@stupidchicken.com> Date: Mon, 14 Mar 2011 12:18:43 -0400 In-Reply-To: (Juanma Barranquero's message of "Mon, 14 Mar 2011 03:41:41 +0100") Message-ID: <871v29vfoc.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.71 on 130.132.50.145 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8219 Cc: 8219@debbugs.gnu.org, Stefan Monnier , emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Juanma Barranquero writes: >> OK, I've committed a fix to trunk. =C2=A0Instead of doing away with the = BUF_* >> macros, I reworked them to handle the indirect buffer case properly. >> This means they can no longer be used in `BUF_PT (foo) =3D bar' assignme= nt >> statements, so I've changed the callers that used them this way. > > emacs -Q --eval '(clone-indirect-buffer "clone" nil)' > > buffer.c:614: Emacs fatal error: assertion failed: NILP (BVAR (b, begv_ma= rker)) Thanks for the catch. This should be fixed now. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 19 12:44:23 2011 Received: (at 8219-done) by debbugs.gnu.org; 19 Mar 2011 16:44:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0zGJ-0002mR-58 for submit@debbugs.gnu.org; Sat, 19 Mar 2011 12:44:23 -0400 Received: from vm-emlprdomr-04.its.yale.edu ([130.132.50.145]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0zGH-0002mG-Pu for 8219-done@debbugs.gnu.org; Sat, 19 Mar 2011 12:44:22 -0400 Received: from furball (c-71-192-165-84.hsd1.ct.comcast.net [71.192.165.84]) (authenticated bits=0) by vm-emlprdomr-04.its.yale.edu (8.14.4/8.14.4) with ESMTP id p2JGiEU1001662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for <8219-done@debbugs.gnu.org>; Sat, 19 Mar 2011 12:44:15 -0400 Received: by furball (Postfix, from userid 1000) id 69922160461; Sat, 19 Mar 2011 12:44:14 -0400 (EDT) From: Chong Yidong To: 8219-done@debbugs.gnu.org Subject: Re: bug#8219: Effect of deletions on indirect buffers (Bug#8219) Date: Sat, 19 Mar 2011 12:44:14 -0400 Message-ID: <87fwqj5ach.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.145 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 8219-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) I have backported the trunk fix to the emacs-23 brach (there seems to be no safer complete solutions). Closing Bug#8219 and Bug#1242. From unknown Mon Jun 23 11:24:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 17 Apr 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator