From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kazuhiro Ito Newsgroups: gmane.emacs.bugs Subject: bug#9318: 23.3.50; The first call of encode-coding-region() returns wrong result Date: Sun, 21 Aug 2011 09:17:05 +0900 Message-ID: <20110821001726.D29052C037@msa104.auone-net.jp> References: <20110818090129.DC129360038@msa102.auone-net.jp> <20110819134637.9727A34803A@msa103.auone-net.jp> <877h67vkpf.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI-EPG 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1313885880 24652 80.91.229.12 (21 Aug 2011 00:18:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 21 Aug 2011 00:18:00 +0000 (UTC) Cc: 9318@debbugs.gnu.org To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 21 02:17:56 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Quvjf-0003DX-Sm for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 Aug 2011 02:17:56 +0200 Original-Received: from localhost ([::1]:53438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Quvjf-00040n-4v for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Aug 2011 20:17:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Quvjc-0003zf-6V for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2011 20:17:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Quvja-0005ON-6B for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2011 20:17:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Quvja-0005OD-37 for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2011 20:17:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Quvli-0002w2-Hf; Sat, 20 Aug 2011 20:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kazuhiro Ito Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Aug 2011 00:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9318 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9318-submit@debbugs.gnu.org id=B9318.131388598811259 (code B ref 9318); Sun, 21 Aug 2011 00:20:02 +0000 Original-Received: (at 9318) by debbugs.gnu.org; 21 Aug 2011 00:19:48 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QuvlT-0002vX-PE for submit@debbugs.gnu.org; Sat, 20 Aug 2011 20:19:48 -0400 Original-Received: from msa104.auone-net.jp ([61.117.18.164]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QuvlO-0002vL-OV for 9318@debbugs.gnu.org; Sat, 20 Aug 2011 20:19:46 -0400 Original-Received: from GUNGNIR.med.osaka-cu.ac.jp (unknown [114.179.36.76]) by msa104.auone-net.jp (au one net msa) with ESMTP id D29052C037; Sun, 21 Aug 2011 09:17:26 +0900 (JST) In-Reply-To: <877h67vkpf.fsf@stupidchicken.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL/10.8 EasyPG/1.0.0 Emacs/23.3.50 (i386-mingw-nt6.1.7601) MULE/6.0 (HANACHIRUSATO) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 20 Aug 2011 20:20:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) 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:50187 Archived-At: > >> When I start Emacs and evaluate the below code, unexpected result retu= rns. > > > >> (let ((func (lambda () > >> (with-temp-buffer > >> (mapc 'insert '(166 25339)) > >> (encode-coding-region (point-min) (point-max) 'ctext-unix) > >> (buffer-string))))) > >> (cons (funcall func) > >> (funcall func))) > >> -> ("=C2=A6=E6=8B=BB^@^@^@^@^@^@^@^@^@^@" . "^[$(D\"C^[$(H*f^[(B") > > > > I noticed this problem is not Windows specific. I confirmed that it > > is reproducible in Emacs 23.3.1 (build by pkgsrc) on NetBSD/amd64 via > > SSH from remote host. But it doesn't occur on openSUSE 11.3. >=20 > Could you run Emacs under a debugger, trigger the crash, and provide a > backtrace? (You will need to have compiled Emacs with debugging > symbols.) I built Emacs 23.3 with "-O0 -g" option on NetBSD 5.1 (amd64), and started with below commad (via SSH). gdb --args emacs -Q --no-splash Next, inputtedand below code and evaluated with C-x C-e. (progn (goto-char (point-min)) (insert #x80) (insert (make-string 16 ?A)) (encode-coding-region 1 18 'ctext-unix)) backtrace is below. Please let me know if you need more information. Program received signal SIGSEGV, Segmentation fault. 0x0000000000557419 in mark_object (arg=3D4702111234474983745) at alloc.c:54= 73 5473 if (STRING_MARKED_P (ptr)) (gdb) bt full #0 0x0000000000557419 in mark_object (arg=3D4702111234474983745) at alloc.= c:5473 ptr =3D (struct Lisp_String *) 0x4141414141414140 obj =3D 4702111234474983745 cdr_count =3D 0 #1 0x0000000000557320 in mark_char_table (ptr=3D0x1281800) at alloc.c:5405 val =3D 4702111234474983745 size =3D 130 i =3D 0 #2 0x0000000000557315 in mark_char_table (ptr=3D0x17f6c00) at alloc.c:5402 val =3D 19404805 size =3D 34 i =3D 14 #3 0x0000000000557315 in mark_char_table (ptr=3D0x13ea700) at alloc.c:5402 val =3D 25127941 size =3D 18 i =3D 6 #4 0x0000000000557315 in mark_char_table (ptr=3D0x10ba800) at alloc.c:5402 val =3D 20883205 size =3D 68 i =3D 4 #5 0x0000000000557838 in mark_object (arg=3D17541125) at alloc.c:5567 obj =3D 17541125 cdr_count =3D 0 #6 0x0000000000557228 in mark_vectorlike (ptr=3D0xb16480) at alloc.c:5377 size =3D 10 i =3D 9 #7 0x0000000000557855 in mark_object (arg=3D11625605) at alloc.c:5569 obj =3D 11625605 cdr_count =3D 0 #8 0x0000000000557228 in mark_vectorlike (ptr=3D0xb56000) at alloc.c:5377 size =3D 434 i =3D 107 #9 0x0000000000557855 in mark_object (arg=3D11886597) at alloc.c:5569 obj =3D 11886597 cdr_count =3D 0 #10 0x00000000005577b0 in mark_object (arg=3D10786565) at alloc.c:5562 h =3D (struct Lisp_Hash_Table *) 0xa49700 obj =3D 10786565 cdr_count =3D 0 #11 0x00000000005568ff in Fgarbage_collect () at alloc.c:5092 bind =3D (struct specbinding *) 0xb96526 catch =3D (struct catchtag *) 0x7f7fffffc508 handler =3D (struct handler *) 0x10 stack_top_variable =3D 0 '\0' i =3D 418 message_p =3D 0 total =3D {140187732526192, 140187732526008, 140187732526000, 42949= 67295,=20 12148454, 10960258, 10312685, 68} count =3D 8 t1 =3D { tv_sec =3D 1313842937,=20 tv_usec =3D 498976 } t2 =3D { tv_sec =3D 0,=20 tv_usec =3D 140187732530104 } t3 =3D { tv_sec =3D 11465618,=20 tv_usec =3D 0 } #12 0x0000000000577bb4 in Ffuncall (nargs=3D2, args=3D0x7f7fffffc4f0) at ev= al.c:2965 fun =3D 10313885 original_fun =3D 10959186 funcar =3D 10762338 numargs =3D 1 lisp_numargs =3D 10950075 val =3D 68 backtrace =3D { next =3D 0x7f7fffffc9a0,=20 function =3D 0x7f7fffffc4f8,=20 args =3D 0x7f7fffffc500,=20 nargs =3D 1,=20 evalargs =3D 0 '\0',=20 debug_on_exit =3D 0 '\0' } internal_args =3D (Lisp_Object *) 0x7f7fffffc500 i =3D 0 #13 0x00000000005ce3c1 in Fbyte_code (bytestr=3D9300689, vector=3D9300725, = maxdepth=3D12) at bytecode.c:680 count =3D 7 op =3D 1 vectorp =3D (Lisp_Object *) 0x8deb00 bytestr_length =3D 18 stack =3D { pc =3D 0x96972f ")\207",=20 top =3D 0x7f7fffffc4f8,=20 bottom =3D 0x7f7fffffc4f0,=20 byte_string =3D 9300689,=20 byte_string_start =3D 0x96971f "\b\203\b",=20 constants =3D 9300725,=20 next =3D 0x7f7fffffcb40 } top =3D (Lisp_Object *) 0x7f7fffffc4f0 result =3D 10956883 #14 0x00000000005788cc in funcall_lambda (fun=3D9300621, nargs=3D1,=20 arg_vector=3D0x7f7fffffca28) at eval.c:3220 val =3D 10762242 syms_left =3D 10762242 next =3D 18577650 count =3D 6 i =3D 1 optional =3D 0 rest =3D 0 #15 0x000000000057821a in Ffuncall (nargs=3D2, args=3D0x7f7fffffca20) at ev= al.c:3077 fun =3D 9300621 original_fun =3D 18577602 funcar =3D 18577842 numargs =3D 1 lisp_numargs =3D 10956963 val =3D 10762242 backtrace =3D { next =3D 0x7f7fffffced0,=20 function =3D 0x7f7fffffca20,=20 args =3D 0x7f7fffffca28,=20 nargs =3D 1,=20 evalargs =3D 0 '\0',=20 debug_on_exit =3D 0 '\0' } internal_args =3D (Lisp_Object *) 0xa730a3 i =3D 0 #16 0x00000000005ce3c1 in Fbyte_code (bytestr=3D9301185, vector=3D9301221, = maxdepth=3D12) at bytecode.c:680 count =3D 5 op =3D 1 vectorp =3D (Lisp_Object *) 0x8decf0 bytestr_length =3D 31 stack =3D { pc =3D 0x969692 "\v)B\211\034A\n=3D\204\033",=20 top =3D 0x7f7fffffca28,=20 bottom =3D 0x7f7fffffca20,=20 byte_string =3D 9301185,=20 byte_string_start =3D 0x969685 "\b\204\b",=20 constants =3D 9301221,=20 next =3D 0x0 } top =3D (Lisp_Object *) 0x7f7fffffca20 result =3D 10762242 #17 0x00000000005788cc in funcall_lambda (fun=3D9301109, nargs=3D1,=20 arg_vector=3D0x7f7fffffcfa8) at eval.c:3220 val =3D 140187732528832 syms_left =3D 10762242 next =3D 18577650 count =3D 4 i =3D 1 optional =3D 0 rest =3D 0 #18 0x000000000057821a in Ffuncall (nargs=3D2, args=3D0x7f7fffffcfa0) at ev= al.c:3077 fun =3D 9301109 original_fun =3D 11438610 funcar =3D 5059672 numargs =3D 1 lisp_numargs =3D 5059670 val =3D 10762242 backtrace =3D { next =3D 0x7f7fffffd310,=20 function =3D 0x7f7fffffcfa0,=20 args =3D 0x7f7fffffcfa8,=20 nargs =3D 1,=20 evalargs =3D 0 '\0',=20 debug_on_exit =3D 0 '\0' } internal_args =3D (Lisp_Object *) 0xa77993 i =3D 0 #19 0x000000000057296b in Fcall_interactively (function=3D11438610,=20 record_flag=3D10762242, keys=3D10790405) at callint.c:869 val =3D 4 args =3D (Lisp_Object *) 0x7f7fffffcfa0 visargs =3D (Lisp_Object *) 0x7f7fffffcf80 specs =3D 9301281 filter_specs =3D 9301281 teml =3D 5734938 up_event =3D 10762242 enable =3D 10762242 speccount =3D 2 next_event =3D 2 prefix_arg =3D 10762242 string =3D (unsigned char *) 0x7f7fffffcfc0 "P" tem =3D (unsigned char *) 0x61652c "" varies =3D (int *) 0x7f7fffffcf60 i =3D 2 j =3D 1 count =3D 1 foo =3D 1 prompt1 =3D '\0' tem1 =3D 0x0 arg_from_tty =3D 0 gcpro1 =3D { next =3D 0xa43802,=20 var =3D 0xa43802,=20 nvars =3D 0 } gcpro2 =3D { next =3D 0xa53bc2,=20 var =3D 0xa51c05,=20 nvars =3D 10828738 } gcpro3 =3D { next =3D 0xa55952,=20 var =3D 0xa53bc2,=20 nvars =3D 2 } gcpro4 =3D { next =3D 0xa43802,=20 var =3D 0xb4a776,=20 nvars =3D 2 } gcpro5 =3D { next =3D 0xa43802,=20 var =3D 0xa43802,=20 nvars =3D 10836306 } key_count =3D 2 record_then_fail =3D 0 save_this_command =3D 11438610 save_last_command =3D 11490098 save_this_original_command =3D 11438610 save_real_this_command =3D 11438610 #20 0x0000000000577f70 in Ffuncall (nargs=3D4, args=3D0x7f7fffffd3b0) at ev= al.c:3037 fun =3D 10312397 original_fun =3D 10978002 funcar =3D 4294967297 numargs =3D 3 lisp_numargs =3D 10937344 val =3D 315 backtrace =3D { next =3D 0x0,=20 function =3D 0x7f7fffffd3b0,=20 args =3D 0x7f7fffffd3b8,=20 nargs =3D 3,=20 evalargs =3D 0 '\0',=20 debug_on_exit =3D 0 '\0' } internal_args =3D (Lisp_Object *) 0x7f7fffffd3b8 i =3D 0 #21 0x000000000057795d in call3 (fn=3D10978002, arg1=3D11438610, arg2=3D107= 62242,=20 arg3=3D10762242) at eval.c:2857 ret_ungc_val =3D 9301109 gcpro1 =3D { next =3D 0x8dec75,=20 var =3D 0xa43802,=20 nvars =3D 4 } args =3D {10978002, 11438610, 10762242, 10762242} #22 0x00000000004e4bca in Fcommand_execute (cmd=3D11438610, record_flag=3D1= 0762242,=20 keys=3D10762242, special=3D10762242) at keyboard.c:10562 final =3D 9301109 tem =3D 10762242 prefixarg =3D 10762242 #23 0x00000000004d564d in command_loop_1 () at keyboard.c:1906 cmd =3D 11438610 lose =3D 1 keybuf =3D {96, 20, 8, 0, 140187732530800, 18451712, 1893, 0,=20 140187732530816, 1983, 18451712, 4294967317, 140187732530800, 6299742, 10= 656928,=20 216, 10937344, 7378697632079252736, 140187732530864, 9720, 274877896416, = 140187732531032, 0, 140187732530872, 140187732530384, 0, 10762242, 123480= 18,=20 8166853, 10762242} i =3D 2 prev_modiff =3D 158 prev_buffer =3D (struct buffer *) 0xa51c00 already_adjusted =3D 0 #24 0x0000000000575049 in internal_condition_case (bfun=3D0x4d3a17 ,=20 handlers=3D10851522, hfun=3D0x4d34bc ) at eval.c:1492 val =3D 10762242 c =3D { tag =3D 10762242,=20 val =3D 10762242,=20 next =3D 0x7f7fffffd880,=20 gcpro =3D 0x0,=20 jmp =3D {2129, 140187732531264, 140187732541408, 140187698962432, 1401876= 96909296,=20 3, 140187732531000, 5722036, 0, 140187732531488, 18636288},=20 backlist =3D 0x0,=20 handlerlist =3D 0x0,=20 lisp_eval_depth =3D 0,=20 pdlcount =3D 2,=20 poll_suppress_count =3D 0,=20 interrupt_input_blocked =3D 0,=20 byte_stack =3D 0x0 } h =3D { handler =3D 10851522,=20 var =3D 10762242,=20 chosen_clause =3D 0,=20 tag =3D 0x7f7fffffd790,=20 next =3D 0x0 } #25 0x00000000004d389f in command_loop_2 () at keyboard.c:1362 val =3D 1 #26 0x0000000000574a0e in internal_catch (tag=3D10846786,=20 func=3D0x4d3885 , arg=3D10762242) at eval.c:1228 c =3D { tag =3D 10846786,=20 val =3D 10762242,=20 next =3D 0x0,=20 gcpro =3D 0x0,=20 jmp =3D {2129, 140187732531488, 140187732541408, 140187698962432, 1401876= 96909296,=20 3, 140187732531288, 5720565, 4301358603, 10820608, 11046651},=20 backlist =3D 0x0,=20 handlerlist =3D 0x0,=20 lisp_eval_depth =3D 0,=20 pdlcount =3D 2,=20 poll_suppress_count =3D 0,=20 interrupt_input_blocked =3D 0,=20 byte_stack =3D 0x0 } #27 0x00000000004d3859 in command_loop () at keyboard.c:1341 No locals. #28 0x00000000004d3004 in recursive_edit_1 () at keyboard.c:956 count =3D 1 val =3D 5059007 #29 0x00000000004d31a6 in Frecursive_edit () at keyboard.c:1018 count =3D 0 buffer =3D 10762242 #30 0x00000000004d169a in main (argc=3D3, argv=3D0x7f7fffffdb70) at emacs.c= :1833 dummy =3D 140187730444288 stack_bottom_variable =3D 0 '\0' do_initial_setlocale =3D 1 skip_args =3D 0 rlim =3D { rlim_cur =3D 8720384,=20 rlim_max =3D 33554432 } no_loadup =3D 0 junk =3D 0x0 dname_arg =3D 0x0 Lisp Backtrace: "eval-last-sexp-1" (0xffffca28) "eval-last-sexp" (0xffffcfa8) "call-interactively" (0xffffd3b8) --=20 Kazuhiro Ito