From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carl Worth Newsgroups: gmane.mail.notmuch.general,gmane.emacs.bugs Subject: 23.1; json-read-string crashes emacs with long string Date: Tue, 18 May 2010 09:08:17 -0700 Message-ID: <87pr0t5h1q.fsf@yoom.home.cworth.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1274198933 6265 80.91.229.12 (18 May 2010 16:08:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 18 May 2010 16:08:53 +0000 (UTC) Cc: Notmuch mailing list To: bug-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: notmuch-bounces-gxuj+Tv9EO5zyzON3hdc1g@public.gmane.org Tue May 18 18:08:51 2010 connect(): No such file or directory Return-path: Envelope-to: gmn-notmuch@m.gmane.org Original-Received: from u15218177.onlinehome-server.com ([82.165.184.25] helo=olra.theworths.org) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OEPLf-0004nY-HJ for gmn-notmuch@m.gmane.org; Tue, 18 May 2010 18:08:51 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C914F4196F3; Tue, 18 May 2010 09:08:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Original-Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vyoAtQyLxO6N; Tue, 18 May 2010 09:08:33 -0700 (PDT) Original-Received: from olra.theworths.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C5F814196F4; Tue, 18 May 2010 09:08:32 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D841D4196F2 for ; Tue, 18 May 2010 09:08:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Original-Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7e0wKEkrUm-i; Tue, 18 May 2010 09:08:17 -0700 (PDT) Original-Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7BA644196F0; Tue, 18 May 2010 09:08:17 -0700 (PDT) Original-Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 111F5568E21; Tue, 18 May 2010 09:08:17 -0700 (PDT) User-Agent: Notmuch/0.3-7-g2baa576 (http://notmuchmail.org) Emacs/23.1.1 (i486-pc-linux-gnu) X-BeenThere: notmuch-gxuj+Tv9EO5zyzON3hdc1g@public.gmane.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: notmuch-bounces-gxuj+Tv9EO5zyzON3hdc1g@public.gmane.org Errors-To: notmuch-bounces-gxuj+Tv9EO5zyzON3hdc1g@public.gmane.org Xref: news.gmane.org gmane.mail.notmuch.general:2848 gmane.emacs.bugs:37016 Archived-At: > Please describe exactly what actions triggered the bug > and the precise symptoms of the bug: A user of the emacs-based mail client, Notmuch [*], found that attempting to display a particular message would consistently causes a segmentation fault in emacs. I tracked this down to calling `json-read-string' with a very long string, (roughly 1 million characters). Rather than including that enormous string in this message, here's a little snippet of emacs lisp that creates and reads such a string. So, if evaluated, this code should trigger the segmentation fault, (assuming a copy of GPLv3 exists at /usr/share/emacs/23.1/etc/COPYING---adjust the filename if necessary). ;; Caution: Evaluating the block below has been known to crash emacs (with-temp-buffer (require 'json) ;; First we just need a lot of text. 32 copies of GPLv3 seems to do it (dotimes (i 32) (insert-file "/usr/share/emacs/23.1/etc/COPYING")) ;; Now create a buffer with a json-encoded version of the text (let ((json-string (json-encode-string (buffer-string)))) (with-temp-buffer (insert json-string) (goto-char (point-min)) ;; And try to read the string. This triggers the segfault. (json-read-string)))) > If Emacs crashed, and you have the Emacs process in the gdb debugger, > please include the output from the following gdb commands: > `bt full' and `xbacktrace'. I haven't attempted to debug this within gdb yet, (I'll have to get my hands on a build of emacs with debugging symbols first). But I wanted to share things right away, so that perhaps someone else could do further debugging and follow up. In the meantime, notmuch folks, if you've got a good idea for modifying notmuch to avoid this bug I'd be glad to hear it. Adjust followups to include the notmuch list and not the gnu.org bug address as appropriate. -Carl [*] http://notmuchmail.org PS. Here are some of the details provided by `report-emacs-bug': In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2) of 2010-01-26 on raven, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10799001 configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t -- carl.d.worth-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org