From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Bill Schottstaedt" Newsgroups: gmane.lisp.guile.bugs Subject: guile 1.9.0 scm_read_hash_extend gc trouble Date: Sun, 21 Jun 2009 05:10:09 -0700 Message-ID: <20090621120823.M97037@ccrma.Stanford.EDU> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: ger.gmane.org 1245586227 12102 80.91.229.12 (21 Jun 2009 12:10:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Jun 2009 12:10:27 +0000 (UTC) To: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jun 21 14:10:24 2009 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MILsM-0003zs-Qf for guile-bugs@m.gmane.org; Sun, 21 Jun 2009 14:10:23 +0200 Original-Received: from localhost ([127.0.0.1]:50204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MILsM-0003Uw-24 for guile-bugs@m.gmane.org; Sun, 21 Jun 2009 08:10:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MILsI-0003UU-LS for bug-guile@gnu.org; Sun, 21 Jun 2009 08:10:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MILsF-0003Tq-7n for bug-guile@gnu.org; Sun, 21 Jun 2009 08:10:18 -0400 Original-Received: from [199.232.76.173] (port=50277 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MILsE-0003Te-OT for bug-guile@gnu.org; Sun, 21 Jun 2009 08:10:14 -0400 Original-Received: from smtp2.stanford.edu ([171.67.219.82]:33456) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MILsE-0001gr-1g for bug-guile@gnu.org; Sun, 21 Jun 2009 08:10:14 -0400 Original-Received: from smtp2.stanford.edu (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with SMTP id AA520170456 for ; Sun, 21 Jun 2009 05:10:12 -0700 (PDT) Original-Received: from cm-mail.stanford.edu (cm-mail.Stanford.EDU [171.64.197.135]) by smtp2.stanford.edu (Postfix) with ESMTP id 18A7B170485 for ; Sun, 21 Jun 2009 05:10:11 -0700 (PDT) Original-Received: from ccrma.Stanford.EDU (localhost.localdomain [127.0.0.1]) by cm-mail.stanford.edu (8.13.8/8.13.8) with ESMTP id n5LCA9vC013409 for ; Sun, 21 Jun 2009 05:10:09 -0700 X-Mailer: OpenWebMail 2.53 X-OriginatingIP: 71.198.184.220 (bil) X-Virus-Scanned: ClamAV 0.94/9492/Sat Jun 20 13:52:40 2009 on cm-mail.stanford.edu X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4230 Archived-At: In the new Guile (1.9.0), the scsh-derived code to implement #|..|# block comment processing triggers either a glibc memory complaint or a segfault. (The following code is slightly translated, so I may have introduced typos, but the basic idea has worked for maybe 10 years): static SCM g_skip_block_comment(SCM ch, SCM port) { int bang_seen = 0; while (true) { int c; c = scm_getc(port); if (c == EOF) { fprintf(stderr, "unterminated `#| ... |#' comment"); return(SCM_BOOL_F); } if (c == '|') bang_seen = 1; else { if ((c == '#') && (bang_seen)) return(SCM_BOOL_F); else bang_seen = 0; } } return(SCM_BOOL_F); } Then call scm_read_hash_extend with "|" to activate it. If I have a file such as: #| ;;; a test |# (or any other file with such a comment), and read it in snd/guile: *** glibc detected *** ../guile-snd/snd: free(): invalid next size (normal): 0x098c4730 *** ======= Backtrace: ========= /lib/libc.so.6[0x39e394] /lib/libc.so.6(cfree+0x96)[0x3a0346] /usr/local/lib/libguile.so.18(scm_gc_free+0x3c)[0x4006a59c] /usr/local/lib/libguile.so.18[0x4008fb6a] /usr/local/lib/libguile.so.18(scm_close_port+0xa5)[0x4008fc35] /usr/local/lib/libguile.so.18(scm_primitive_load+0xdd)[0x4007ccdd] /usr/local/lib/libguile.so.18(scm_c_primitive_load+0x25)[0x4007d135] ../guile-snd/snd[0x8160d46] /usr/local/lib/libguile.so.18(scm_c_with_throw_handler+0x10b)[0x400c64db] /usr/local/lib/libguile.so.18(scm_internal_lazy_catch+0x41)[0x400c6671] /usr/local/lib/libguile.so.18[0x400c674f] /usr/local/lib/libguile.so.18(scm_c_catch+0x28d)[0x400c69ed] /usr/local/lib/libguile.so.18(scm_internal_catch+0x49)[0x400c6c39] /usr/local/lib/libguile.so.18(scm_internal_stack_catch+0x4b)[0x400c6cfb] ../guile-snd/snd(snd_catch_any+0x42)[0x8161232] ../guile-snd/snd(snd_load_file+0xac)[0x816159c] ../guile-snd/snd(handle_next_startup_arg+0x29f)[0x8144dbf] ../guile-snd/snd(snd_doit+0x60d)[0x81cd26d] /usr/local/lib/libguile.so.18[0x400788a6] /usr/local/lib/libguile.so.18[0x4004e072] /usr/local/lib/libguile.so.18(scm_c_catch+0x28d)[0x400c69ed] /usr/local/lib/libguile.so.18[0x4004e692] /usr/local/lib/libguile.so.18(scm_c_with_continuation_barrier+0x53)[0x4004e773] /usr/local/lib/libguile.so.18[0x400c539c] /usr/local/lib/libguile.so.18(scm_with_guile+0x2e)[0x400c54ae] /usr/local/lib/libguile.so.18(scm_boot_guile+0x3f)[0x4007883f] ../guile-snd/snd(main+0x32)[0x8159782] /lib/libc.so.6(__libc_start_main+0xe5)[0x3456d5] ../guile-snd/snd[0x8065621] ======= Memory map: ======== 0030a000-0032a000 r-xp 00000000 fd:00 13018312 /lib/ld-2.9.so 0032b000-0032c000 r-xp 00020000 fd:00 13018312 /lib/ld-2.9.so 0032c000-0032d000 rwxp 00021000 fd:00 13018312 /lib/ld-2.9.so 0032f000-0049d000 r-xp 00000000 fd:00 13018313 /lib/libc-2.9.so 0049d000-0049f000 r-xp 0016e000 fd:00 13018313 /lib/libc-2.9.so 0049f000-004a0000 rwxp 00170000 fd:00 13018313 /lib/libc-2.9.so 004a0000-004a3000 rwxp 004a0000 00:00 0 004a5000-004cc000 r-xp 00000000 fd:00 13018324 /lib/libm-2.9.so 004cc000-004cd000 r-xp 00026000 fd:00 13018324 /lib/libm-2.9.so 004cd000-004ce000 rwxp 00027000 fd:00 13018324 /lib/libm-2.9.so 004d0000-004d3000 r-xp 00000000 fd:00 13018319 /lib/libdl-2.9.so 004d3000-004d4000 r-xp 00002000 fd:00 13018319 /lib/libdl-2.9.so 004d4000-004d5000 rwxp 00003000 fd:00 13018319 /lib/libdl-2.9.so 004d7000-004ed000 r-xp 00000000 fd:00 13018314 /lib/libpthread-2.9.so 004ed000-004ee000 r-xp 00015000 fd:00 13018314 /lib/libpthread-2.9.so 004ee000-004ef000 rwxp 00016000 fd:00 13018314 /lib/libpthread-2.9.so 004ef000-004f1000 rwxp 004ef000 00:00 0 009d4000-009e1000 r-xp 00000000 fd:00 13018327 /lib/libgcc_s-4.3.2-20081105.so.1 009e1000-009e2000 rwxp 0000c000 fd:00 13018327 /lib/libgcc_s-4.3.2-20081105.so.1 055c4000-055ce000 r-xp 00000000 fd:00 13018344 /lib/libcrypt-2.9.so 055ce000-055cf000 r-xp 00009000 fd:00 13018344 /lib/libcrypt-2.9.so 055cf000-055d0000 rwxp 0000a000 fd:00 13018344 /lib/libcrypt-2.9.so 055d0000-055f7000 rwxp 055d0000 00:00 0 08048000-082eb000 r-xp 00000000 fd:00 21537167 /home/bil/guile-snd/snd 082eb000-082f1000 rwxp 002a3000 fd:00 21537167 /home/bil/guile-snd/snd 082f1000-082f3000 rwxp 082f1000 00:00 0 0977f000-098db000 rwxp 0977f000 00:00 0 [heap] 40000000-40001000 r-xp 40000000 00:00 0 [vdso] 40001000-40002000 rwxp 40001000 00:00 0 40002000-40005000 r-xs 00000000 fd:00 14231648 /usr/local/lib/guile/1.9/ccache/ice- 9/r4rs.go 40005000-40007000 r-xs 00000000 fd:00 14231672 /usr/local/lib/guile/1.9/ccache/ice- 9/posix.go 40007000-40009000 r-xs 00000000 fd:00 14231666 /usr/local/lib/guile/1.9/ccache/ice- 9/networking.go 40009000-4000c000 r-xs 00000000 fd:00 14231696 /usr/local/lib/guile/1.9/ccache/ice- 9/deprecated.go 4000c000-4000d000 r-xp 02388000 fd:00 13649054 /usr/lib/locale/locale-archive 4000d000-40012000 r-xs 00000000 fd:00 14231669 /usr/local/lib/guile/1.9/ccache/ice- 9/optargs.go 4001e000-4010c000 r-xp 00000000 fd:00 3154070 /usr/local/lib/libguile.so.18.0.0 4010c000-40110000 rwxp 000ee000 fd:00 3154070 /usr/local/lib/libguile.so.18.0.0 40110000-4011b000 rwxp 40110000 00:00 0 4011b000-40223000 r-xp 00000000 fd:00 3154130 /usr/local/lib/libunistring.so.0.0.0 40223000-40225000 rwxp 00108000 fd:00 3154130 /usr/local/lib/libunistring.so.0.0.0 40225000-40270000 r-xp 00000000 fd:00 3154050 /usr/local/lib/libgmp.so.3.5.0 40270000-40271000 rwxp 0004a000 fd:00 3154050 /usr/local/lib/libgmp.so.3.5.0 40271000-40272000 rwxp 40271000 00:00 0 40272000-40279000 r-xp 00000000 fd:00 3153921 /usr/local/lib/libltdl.so.7.2.0 40279000-4027a000 rwxp 00006000 fd:00 3153921 /usr/local/lib/libltdl.so.7.2.0 4027a000-4041b000 r-xp 00000000 fd:00 13653194 /usr/local/lib/libgsl.so.0.13.0 4041b000-40425000 rwxp 001a0000 fd:00 13653194 /usr/local/lib/libgsl.so.0.13.0 40425000-4045a000 r-xp 00000000 fd:00 13652488 /usr/local/lib/libgslcblas.so.0.0.0 4045a000-4045b000 rwxp 00035000 fd:00 13652488 /usr/local/lib/libgslcblas.so.0.0.0 4045b000-404a0000 rwxp 4045b000 00:00 0 404a0000-404cb000 r-xs 00000000 fd:00 14231647 /usr/local/lib/guile/1.9/ccache/ice- 9/boot-9.go 404cb000-40500000 r-xs 00000000 fd:00 14231646 /usr/local/lib/guile/1.9/ccache/ice- 9/psyntax-pp.go 40500000-40700000 r-xp 00000000 fd:00 13649054 /usr/lib/locale/locale-archive 40700000-4073c000 r-xp 0232f000 fd:00 13649054 /usr/lib/locale/locale-archive 40800000-40821000 rwxp 40800000 00:00 0 40821000-40900000 ---p 40821000 00:00 0 bfbac000-bfbc1000 rwxp bffeb000 00:00 0 [stack] Abort (core dumped) in gdb: Program received signal SIGABRT, Aborted. 0x40000424 in __kernel_vsyscall () Missing separate debuginfos, use: debuginfo-install glibc-2.9-2.i686 libgcc-4.3.2-7.i386 (gdb) where #0 0x40000424 in __kernel_vsyscall () #1 0x0035a450 in raise () from /lib/libc.so.6 #2 0x0035be18 in abort () from /lib/libc.so.6 #3 0x00397fdd in __libc_message () from /lib/libc.so.6 #4 0x0039e394 in malloc_printerr () from /lib/libc.so.6 #5 0x003a0346 in free () from /lib/libc.so.6 #6 0x4006a59c in scm_gc_free (mem=0x8438738, size=92, what=0x400ff274 "port") at gc-malloc.c:370 #7 0x4008fb6a in scm_i_remove_port (port=0x841ef58) at ports.c:553 #8 0x4008fc35 in scm_close_port (port=0x841ef58) at ports.c:730 #9 0x4007ccdd in scm_primitive_load (filename=0x83c9410) at load.c:120 #10 0x4007d135 in scm_c_primitive_load (filename=0x84387f0 "/home/bil/cl/g.scm") at load.c:129 #11 0x08160d46 in eval_file_wrapper (data=0x84387f0) at snd-xen.c:979 #12 0x400c64db in scm_c_with_throw_handler (tag=0x104, body=0x8160d30 , body_data=0x84387f0, handler=0x400c6370 , handler_data=0x0, lazy_catch_p=1) at throw.c:317 #13 0x400c6671 in scm_internal_lazy_catch (tag=0x104, body=0x8160d30 , body_data=0x84387f0, handler=0x400c6370 , handler_data=0x0) at throw.c:332 #14 0x400c674f in cwss_body (data=0xbfffef48) at throw.c:361 #15 0x400c69ed in scm_c_catch (tag=0x104, body=0x400c6710 , body_data=0xbfffef48, handler=0x8162f00 , handler_data=0x8438470, pre_unwind_handler=0, pre_unwind_handler_data=0x0) at throw.c:242 #16 0x400c6c39 in scm_internal_catch (tag=0x104, body=0x400c6710 , body_data=0xbfffef48, handler=0x8162f00 , handler_data=0x8438470) at throw.c:256 #17 0x400c6cfb in scm_internal_stack_catch (tag=0x104, body=0x8160d30 , body_data=0x84387f0, handler=0x8162f00 , handler_data=0x8438470) at throw.c:375 #18 0x08161232 in snd_internal_stack_catch () at snd-xen.c:644 #19 snd_catch_any (body=0x8160d30 , body_data=0x84387f0, caller=0x8438470 "(load \"g.scm\")") at snd-xen.c:666 #20 0x0816159c in snd_load_file (filename=0xbffff50f "g.scm") at snd-xen.c:1349 #21 0x08144dbf in handle_next_startup_arg (auto_open_ctr=1, auto_open_file_names=0xbffff348, with_title=false, args=2) at snd-main.c:1579 #22 0x081cd26d in snd_doit (argc=3, argv=0xbffff344) at snd-nogui.c:720 #23 0x400788a6 in invoke_main_func (body_data=0xbffff274) at init.c:372 #24 0x4004e072 in c_body (d=0xbffff1c8) at continuations.c:354 #25 0x400c69ed in scm_c_catch (tag=0x104, body=0x4004e060 , body_data=0xbffff1c8, handler=0x4004e080 , handler_data=0xbffff1c8, pre_unwind_handler=0x400c5c40 , pre_unwind_handler_data=0x0) at throw.c:242 #26 0x4004e692 in scm_i_with_continuation_barrier (body=0x4004e060 , body_data=0xbffff1c8, handler=0x4004e080 , handler_data=0xbffff1c8, pre_unwind_handler=0x400c5c40 , pre_unwind_handler_data=0x0) at continuations.c:330 #27 0x4004e773 in scm_c_with_continuation_barrier (func=0x40078860 , data=0xbffff274) at continuations.c:372 #28 0x400c539c in scm_i_with_guile_and_parent (func=0x40078860 , data=0xbffff274, parent=0x0) at threads.c:852 #29 0x400c54ae in scm_with_guile (func=0x40078860 , data=0xbffff274) at threads.c:831 #30 0x4007883f in scm_boot_guile (argc=3, argv=0xbffff344, main_func=0x815a120 , closure=0x0) at init.c:355 #31 0x08159782 in main (argc=Cannot access memory at address 0x7358 ) at snd.c:518 (gdb) up #7 0x4008fb6a in scm_i_remove_port (port=0x841ef58) at ports.c:553 553 scm_gc_free (p, sizeof (scm_t_port), "port"); (gdb) p p $1 = (scm_t_port *) 0x8438738 (gdb) p ((scm_t_port *)p)[0] $3 = {port = 0x841ef58, revealed = 0, stream = 138074392, file_name = 0x83c9410, line_number = 3, column_number = 0, read_buf = 0x844d800 "#|\n;;; a test\n|#\n", read_pos = 0x844d811 "", read_end = 0x844d811 "", read_buf_size = 4096, saved_read_buf = 0x844d800 "#|\n;;; a test\n|#\n", saved_read_pos = 0x844d802 "\n;;; a test\n|#\n", saved_read_end = 0x844d811 "", saved_read_buf_size = 4096, write_buf = 0x8438780 "", write_pos = 0x8438780 "", write_end = 0x8438781 "", write_buf_size = 1, shortbuf = 0 '\0', rw_random = 1, rw_active = SCM_PORT_NEITHER, putback_buf = 0x83b3270 "\020Ù:\bp\001J", putback_buf_size = 4}