From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.bugs Subject: bug#716: Bug in buffer-swap-text Date: Tue, 23 Dec 2008 22:51:34 +0800 Message-ID: <4950FAF6.808@f2s.com> References: <4950DD60.4080202@gnu.org> Reply-To: Jason Rumney , 716@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000103070006060205020408" X-Trace: ger.gmane.org 1230044792 29535 80.91.229.12 (23 Dec 2008 15:06:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Dec 2008 15:06:32 +0000 (UTC) Cc: Magnus Henoch , 716@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 23 16:07:37 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LF8qr-0001BZ-Rk for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Dec 2008 16:07:18 +0100 Original-Received: from localhost ([127.0.0.1]:42880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LF8pf-0006zG-55 for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Dec 2008 10:06:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LF8pc-0006yz-IQ for bug-gnu-emacs@gnu.org; Tue, 23 Dec 2008 10:06:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LF8pc-0006ym-05 for bug-gnu-emacs@gnu.org; Tue, 23 Dec 2008 10:06:00 -0500 Original-Received: from [199.232.76.173] (port=58270 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LF8pb-0006yj-TN for bug-gnu-emacs@gnu.org; Tue, 23 Dec 2008 10:05:59 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:57980) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LF8pa-0003fM-OZ for bug-gnu-emacs@gnu.org; Tue, 23 Dec 2008 10:05:59 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBNF3KCi023367; Tue, 23 Dec 2008 07:03:20 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mBNEt5EB020420; Tue, 23 Dec 2008 06:55:05 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Jason Rumney Original-Sender: Jason Rumney Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs , owner@emacsbugs.donarmstrong.com Resent-Date: Tue, 23 Dec 2008 14:55:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 716 X-Emacs-PR-Package: emacs,w32 X-Emacs-PR-Keywords: Original-Received: via spool by 716-submit@emacsbugs.donarmstrong.com id=B716.123004393419992 (code B ref 716); Tue, 23 Dec 2008 14:55:05 +0000 Original-Received: (at 716) by emacsbugs.donarmstrong.com; 23 Dec 2008 14:52:14 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from ti-out-0910.google.com (ti-out-0910.google.com [209.85.142.186]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBNEq6gG019979 for <716@emacsbugs.donarmstrong.com>; Tue, 23 Dec 2008 06:52:08 -0800 Original-Received: by ti-out-0910.google.com with SMTP id b6so1845051tic.1 for <716@emacsbugs.donarmstrong.com>; Tue, 23 Dec 2008 06:52:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=7sIApbofwOUBxvw96ou/pkPzlTiWdqA6SLOgB3eJxnY=; b=PWYBSzaG6M7qLc3fUO0wx0kVnf6VO+7B54p4r3M9do/JBVDEOft8QG9SdDVZ3KRQxR cLp41sy8Mi4XkbdPsUGq1y4Tkvlg02Y7l2PET8CuNVjvlltrBRTc3hroJGTHkC0hsAys hEMNf/s+gl5xIPhOO7zp6fkOyFgkS3w/zQ958= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=Jl0zOlgKbqdEpq+UnQceGgSqSeG8/JKNbP3kHLEWtbfPBMRC0SjfPf/ImbnjZpqjsG qhX/pTdjjkHRNdwCHb79J1BCqQS0ksAYWCdvXaHUntGTc+AW6KRr0v8lLGbTugmy8pZL eUUFbFOMjlR9TWuuDO1oxplnWf59b1LFQ6tYA= Original-Received: by 10.110.31.5 with SMTP id e5mr217417tie.45.1230043925998; Tue, 23 Dec 2008 06:52:05 -0800 (PST) Original-Received: from ?192.168.1.3? ([118.101.181.97]) by mx.google.com with ESMTPS id a14sm1236981tia.12.2008.12.23.06.52.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Dec 2008 06:52:05 -0800 (PST) User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) In-Reply-To: <4950DD60.4080202@gnu.org> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 23 Dec 2008 10:06:00 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23447 Archived-At: This is a multi-part message in MIME format. --------------000103070006060205020408 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jason Rumney wrote: > One possible variable here is the way that buffer space is allocated. > On Windows, it seems REL_ALLOC is defined. I presume GNU/Linux defines > USE_MMAP_FOR_BUFFERS which would cause it to take a different code > path around the point where we see a crash on Windows, and as Magnus > Henoch saw on NetBSD/powerpc also (though we don't have a stack trace > for that crash, so can't tell for sure it is crashing in the same place). The following patch seems to fix the problem, does it look correct to others who might understand ralloc.c and buffer_swap_text better than I do? --------------000103070006060205020408 Content-Type: text/plain; name="bug716.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bug716.diff" Index: buffer.c =================================================================== RCS file: /sources/emacs/emacs/src/buffer.c,v retrieving revision 1.575 diff -r1.575 buffer.c 2184a2185,2189 > #ifdef REL_ALLOC > extern void r_alloc_prepare_to_swap_pointers P_ ((POINTER_TYPE **, > POINTER_TYPE **)); > #endif > 2222a2228,2232 > #ifdef REL_ALLOC > r_alloc_prepare_to_swap_pointers (¤t_buffer->own_text.beg, > &other_buffer->own_text.beg); > #endif > Index: ralloc.c =================================================================== RCS file: /sources/emacs/emacs/src/ralloc.c,v retrieving revision 1.69 diff -r1.69 ralloc.c 1225a1226,1248 > /* Swap relocatable data between two pointers. > This is used by buffer_swap_text. Since buffer_swap_text swaps the > whole text structure in one go, this function has been written to only > update the internal pointers back to the variables, ready for when the > swap is actually done. It must be called before the pointers are > swapped so that the state is consistent when find_bloc is called. */ > void > r_alloc_prepare_to_swap_pointers (p1, p2) > POINTER *p1, *p2; > { > bloc_ptr bloc1, bloc2; > bloc1 = find_bloc (p1); > bloc2 = find_bloc (p2); > if (bloc1 == NIL_BLOC || bloc2 == NIL_BLOC) > abort (); > > /* Swap internal pointers back to the variables. */ > bloc1->variable = p2; > bloc2->variable = p1; > > /* It would be cleaner to do the actual swap here too, but it would > complicate buffer_swap_text. */ > } --------------000103070006060205020408--