Received: (at 14404) by debbugs.gnu.org; 11 Mar 2014 23:15:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 11 19:15:22 2014 Received: from localhost ([127.0.0.1]:33666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1WNVtH-0002PL-GM for submit <at> debbugs.gnu.org; Tue, 11 Mar 2014 19:15:21 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:60776) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <ludo@HIDDEN>) id 1WNVtC-0002P3-M1 for 14404 <at> debbugs.gnu.org; Tue, 11 Mar 2014 19:15:17 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CC9431F99; Wed, 12 Mar 2014 00:15:12 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t0y5J0OUKImx; Wed, 12 Mar 2014 00:15:12 +0100 (CET) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id DBC691F8B; Wed, 12 Mar 2014 00:15:11 +0100 (CET) From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Paul Eggert <eggert@HIDDEN> Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> <5199448F.9050608@HIDDEN> <87d2slu413.fsf@HIDDEN> <51A288AD.4070405@HIDDEN> <51A6A489.2060101@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 22 =?utf-8?Q?Vent=C3=B4se?= an 222 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Wed, 12 Mar 2014 00:15:11 +0100 In-Reply-To: <51A6A489.2060101@HIDDEN> (Paul Eggert's message of "Wed, 29 May 2013 17:59:53 -0700") Message-ID: <87iorknx8g.fsf@HIDDEN> User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 14404 Cc: 14404 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.0 (+) Paul Eggert <eggert@HIDDEN> skribis: > On 05/26/2013 03:11 PM, Paolo Bonzini wrote: >> Use the lock module instead. > > Adding the lock module should work. But this will require > some reengineering of Guile, so that Guile uses the lock module > rather than its own thread packaging. Another possibility, which > might be a bit simpler, would be for Guile to pretend to > have the lock module. It could do that by creating a file > glthread/lock.h that looks something like this: > > #include "../libguile/threads.h" > #define gl_lock_define(class, name) class scm_i_pthread_mutex_t name; > #define glthread_lock_init scm_i_pthread_mutex_init > #define glthread_lock_destroy scm_i_pthread_mutex_destroy > #define glthread_lock_lock scm_i_pthread_mutex_lock > #define glthread_lock_unlock scm_i_pthread_mutex_lock_unlock > > and by putting AC_DEFINE([GNULIB_LOCK]) into configure.ac. (Stripping Cc list.) It=E2=80=99s been almost a year, but I=E2=80=99ve finally implemented this = suggestion: http://git.savannah.gnu.org/cgit/guile.git/commit/?h=3Dstable-2.0&id=3D8f= 7887d61604073528544ccb09849ca0e2f4df78 Now regex_internal.c does use pthread locks: --8<---------------cut here---------------start------------->8--- $ nm lib/.libs/regex.o |grep pthread U pthread_mutex_destroy U pthread_mutex_init U pthread_mutex_lock U pthread_mutex_unlock --8<---------------cut here---------------end--------------->8--- However, the example given at <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14404#8> still exposes a similar bug, but possibly in Guile land this time: --8<---------------cut here---------------start------------->8--- $ while true ; do timeout 2s ./meta/guile regexec-thread.scm ; done timeout: the monitored command dumped core Segmentation fault $ gdb libguile/.libs/guile core=20 [...] Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f275c5cee7b in GC_build_fl4 () from /nix/store/f072ihgps3078d9l7= 1w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 (gdb) thread apply all bt Thread 5 (Thread 0x7f2759a49700 (LWP 30825)): #0 0x00007f275c3a574c in __lll_lock_wait () from /nix/store/jwd1hc3i3pmnsx= f2347r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #1 0x00007f275c3a1417 in _L_lock_913 () from /nix/store/jwd1hc3i3pmnsxf234= 7r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #2 0x00007f275c3a1240 in pthread_mutex_lock () from /nix/store/jwd1hc3i3pm= nsxf2347r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #3 0x00007f275c5c7e95 in GC_call_with_alloc_lock () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #4 0x00007f275c89ed69 in scm_hash_fn_get_handle_by_hash (table=3D<optimize= d out>, raw_hash=3Draw_hash@entry=3D5431120,=20 predicate_fn=3Dpredicate_fn@entry=3D0x7f275c8f5e00 <string_lookup_predi= cate_fn>, closure=3Dclosure@entry=3D0x7f2759a48860) at hashtab.c:659 #5 0x00007f275c8f5a91 in lookup_interned_symbol (raw_hash=3D5431120, name= =3D0x2c22100) at symbols.c:113 #6 scm_i_str2symbol (str=3D0x2c22100) at symbols.c:210 #7 0x00007f275c90fa3d in vm_regular_engine (vm=3D<optimized out>, program= =3D0x7f275cba9768 <scm_string_to_symbol.subr_raw_cell>,=20 argv=3D<optimized out>, nargs=3D1) at vm-i-system.c:852 #8 0x00007f275c8f7b80 in really_launch (d=3D0x7fff4246a800) at threads.c:1= 005 #9 0x00007f275c87d7aa in c_body (d=3D0x7f2759a48d70) at continuations.c:517 #10 0x00007f275c90fa28 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x26d0040, argv=3D<optimized out>, nargs=3D2) at vm-i-system.c:855 #11 0x00007f275c886fe3 in scm_call_4 (proc=3D0x27d8c30, arg1=3Darg1@entry= =3D0x404, arg2=3D<optimized out>, arg3=3D<optimized out>,=20 arg4=3D<optimized out>) at eval.c:507 #12 0x00007f275c8f9999 in scm_catch_with_pre_unwind_handler (key=3Dkey@entr= y=3D0x404, thunk=3D<optimized out>, handler=3D<optimized out>,=20 pre_unwind_handler=3D<optimized out>) at throw.c:73 #13 0x00007f275c8f9a9f in scm_c_catch (tag=3Dtag@entry=3D0x404, body=3Dbody= @entry=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f2759a48d70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f2759a48d70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>,=20 pre_unwind_handler_data=3Dpre_unwind_handler_data@entry=3D0x26d5040) at= throw.c:207 #14 0x00007f275c87deef in scm_i_with_continuation_barrier (body=3Dbody@entr= y=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f2759a48d70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f2759a48d70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>, pre_unwind_handler_data=3D0x26d5040) at continuations.c:455 #15 0x00007f275c87df85 in scm_c_with_continuation_barrier (func=3D<optimize= d out>, data=3D<optimized out>) at continuations.c:551 #16 0x00007f275c8f738c in with_guile_and_parent (base=3D0x7f2759a48dd0, dat= a=3D0x7f2759a48e00) at threads.c:906 #17 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #18 0x00007f275c8f6d4c in scm_i_with_guile_and_parent (parent=3D<optimized = out>, data=3D0x7fff4246a800,=20 func=3D0x7f275c8f7b00 <really_launch>) at threads.c:949 #19 launch_thread (d=3D0x7fff4246a800) at threads.c:1017 #20 0x00007f275c5d2ec3 in GC_inner_start_routine () from /nix/store/f072ihg= ps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #21 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #22 0x00007f275c39f052 in start_thread () from /nix/store/jwd1hc3i3pmnsxf23= 47r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #23 0x00007f275add3b7d in clone () from /nix/store/jwd1hc3i3pmnsxf2347r4k2c= 77nbr9vw-glibc-2.18/lib/libc.so.6 Thread 4 (Thread 0x7f275cdcf740 (LWP 30798)): #0 0x00007f275ad6ad0c in malloc () from /nix/store/jwd1hc3i3pmnsxf2347r4k2= c77nbr9vw-glibc-2.18/lib/libc.so.6 #1 0x00007f275c921eb8 in re_node_set_alloc (size=3D0, set=3D0x2ce6f80) at = regex_internal.c:976 #2 register_state (dfa=3D0x2cdf8e0, newstate=3Dnewstate@entry=3D0x2ce6f60,= hash=3Dhash@entry=3D23) at regex_internal.c:1575 #3 0x00007f275c9252f3 in create_cd_newstate (hash=3D<optimized out>, conte= xt=3D1, nodes=3D0x2ce6f60, dfa=3D0x2) at regex_internal.c:1734 #4 re_acquire_state_context (err=3Derr@entry=3D0x7fff4246a730, dfa=3Ddfa@e= ntry=3D0x2cdf8e0, nodes=3Dnodes@entry=3D0x7fff4246a740,=20 context=3Dcontext@entry=3D1) at regex_internal.c:1554 #5 0x00007f275c92d8a3 in create_initial_state (dfa=3D0x2cdf8e0) at regcomp= .c:1084 #6 re_compile_internal (preg=3Dpreg@entry=3D0x29b0540, pattern=3Dpattern@e= ntry=3D0x2cddf80 "^http://([^/]+)/(.*)$",=20 length=3D<optimized out>, syntax=3Dsyntax@entry=3D242428) at regcomp.c:= 837 #7 0x00007f275c92e350 in rpl_regcomp (preg=3Dpreg@entry=3D0x29b0540, patte= rn=3Dpattern@entry=3D0x2cddf80 "^http://([^/]+)/(.*)$",=20 cflags=3Dcflags@entry=3D1) at regcomp.c:506 #8 0x00007f275c91b2cf in scm_make_regexp (pat=3D0x28c5120, flags=3D<optimi= zed out>) at regex-posix.c:166 #9 0x00007f275c90fa28 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x7f275cbac590 <scm_make_regexp.subr_raw_cell>,=20 argv=3D<optimized out>, nargs=3D2) at vm-i-system.c:855 #10 0x00007f275c90fa3d in vm_regular_engine (vm=3D<optimized out>, program= =3D0x26c64c0, argv=3D<optimized out>, nargs=3D1) at vm-i-system.c:852 #11 0x00007f275c8874a3 in scm_primitive_eval (exp=3Dexp@entry=3D0x28bbbb0) = at eval.c:692 #12 0x00007f275c887503 in scm_eval (exp=3D0x28bbbb0, module_or_state=3Dmodu= le_or_state@entry=3D0x2890c60) at eval.c:726 #13 0x00007f275c8d662d in scm_shell (argc=3D2, argv=3D0x7fff4246b1c8) at sc= ript.c:439 #14 0x00007f275c8a398d in invoke_main_func (body_data=3D0x7fff4246b090) at = init.c:336 #15 0x00007f275c87d7aa in c_body (d=3D0x7fff4246afd0) at continuations.c:517 #16 0x00007f275c90fa28 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x26d0040, argv=3D<optimized out>, nargs=3D2) at vm-i-system.c:855 #17 0x00007f275c886fe3 in scm_call_4 (proc=3D0x27d8c30, arg1=3Darg1@entry= =3D0x404, arg2=3D<optimized out>, arg3=3D<optimized out>,=20 arg4=3D<optimized out>) at eval.c:507 #18 0x00007f275c8f9999 in scm_catch_with_pre_unwind_handler (key=3Dkey@entr= y=3D0x404, thunk=3D<optimized out>, handler=3D<optimized out>,=20 pre_unwind_handler=3D<optimized out>) at throw.c:73 #19 0x00007f275c8f9a9f in scm_c_catch (tag=3Dtag@entry=3D0x404, body=3Dbody= @entry=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7fff4246afd0, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7fff4246afd0,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>,=20 pre_unwind_handler_data=3Dpre_unwind_handler_data@entry=3D0x26d5040) at= throw.c:207 #20 0x00007f275c87deef in scm_i_with_continuation_barrier (body=3Dbody@entr= y=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7fff4246afd0, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7fff4246afd0,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>, pre_unwind_handler_data=3D0x26d5040) at continuations.c:455 #21 0x00007f275c87df85 in scm_c_with_continuation_barrier (func=3D<optimize= d out>, data=3D<optimized out>) at continuations.c:551 #22 0x00007f275c8f738c in with_guile_and_parent (base=3D0x7fff4246b030, dat= a=3D0x7fff4246b060) at threads.c:906 #23 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #24 0x00007f275c8f7748 in scm_i_with_guile_and_parent (parent=3D<optimized = out>, data=3Ddata@entry=3D0x7fff4246b060,=20 func=3Dfunc@entry=3D0x7f275c8a3970 <invoke_main_func>) at threads.c:949 #25 scm_with_guile (func=3Dfunc@entry=3D0x7f275c8a3970 <invoke_main_func>, = data=3Ddata@entry=3D0x7fff4246b090) at threads.c:955 #26 0x00007f275c8a3b25 in scm_boot_guile (argc=3Dargc@entry=3D2, argv=3Darg= v@entry=3D0x7fff4246b1c8,=20 main_func=3Dmain_func@entry=3D0x400ff0 <inner_main>, closure=3Dclosure@= entry=3D0x0) at init.c:319 #27 0x0000000000400eb4 in main (argc=3D2, argv=3D0x7fff4246b1c8) at guile.c= :108 Thread 3 (Thread 0x7f275aaeb700 (LWP 30823)): #0 0x00007f275c3a574c in __lll_lock_wait () from /nix/store/jwd1hc3i3pmnsx= f2347r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #1 0x00007f275c3a1417 in _L_lock_913 () from /nix/store/jwd1hc3i3pmnsxf234= 7r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #2 0x00007f275c3a1240 in pthread_mutex_lock () from /nix/store/jwd1hc3i3pm= nsxf2347r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #3 0x00007f275c8f5a78 in lookup_interned_symbol (raw_hash=3D5431120, name= =3D0x2c34e40) at symbols.c:112 #4 scm_i_str2symbol (str=3D0x2c34e40) at symbols.c:210 #5 0x00007f275c90fa3d in vm_regular_engine (vm=3D<optimized out>, program= =3D0x7f275cba9768 <scm_string_to_symbol.subr_raw_cell>,=20 argv=3D<optimized out>, nargs=3D1) at vm-i-system.c:852 #6 0x00007f275c8f7b80 in really_launch (d=3D0x7fff4246a800) at threads.c:1= 005 #7 0x00007f275c87d7aa in c_body (d=3D0x7f275aaead70) at continuations.c:517 #8 0x00007f275c90fa28 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x26d0040, argv=3D<optimized out>, nargs=3D2) at vm-i-system.c:855 #9 0x00007f275c886fe3 in scm_call_4 (proc=3D0x27d8c30, arg1=3Darg1@entry= =3D0x404, arg2=3D<optimized out>, arg3=3D<optimized out>,=20 arg4=3D<optimized out>) at eval.c:507 #10 0x00007f275c8f9999 in scm_catch_with_pre_unwind_handler (key=3Dkey@entr= y=3D0x404, thunk=3D<optimized out>, handler=3D<optimized out>,=20 pre_unwind_handler=3D<optimized out>) at throw.c:73 #11 0x00007f275c8f9a9f in scm_c_catch (tag=3Dtag@entry=3D0x404, body=3Dbody= @entry=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f275aaead70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f275aaead70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>,=20 pre_unwind_handler_data=3Dpre_unwind_handler_data@entry=3D0x26d5040) at= throw.c:207 #12 0x00007f275c87deef in scm_i_with_continuation_barrier (body=3Dbody@entr= y=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f275aaead70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f275aaead70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>, pre_unwind_handler_data=3D0x26d5040) at continuations.c:455 #13 0x00007f275c87df85 in scm_c_with_continuation_barrier (func=3D<optimize= d out>, data=3D<optimized out>) at continuations.c:551 #14 0x00007f275c8f738c in with_guile_and_parent (base=3D0x7f275aaeadd0, dat= a=3D0x7f275aaeae00) at threads.c:906 #15 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #16 0x00007f275c8f6d4c in scm_i_with_guile_and_parent (parent=3D<optimized = out>, data=3D0x7fff4246a800,=20 func=3D0x7f275c8f7b00 <really_launch>) at threads.c:949 #17 launch_thread (d=3D0x7fff4246a800) at threads.c:1017 #18 0x00007f275c5d2ec3 in GC_inner_start_routine () from /nix/store/f072ihg= ps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #19 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #20 0x00007f275c39f052 in start_thread () from /nix/store/jwd1hc3i3pmnsxf23= 47r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #21 0x00007f275add3b7d in clone () from /nix/store/jwd1hc3i3pmnsxf2347r4k2c= 77nbr9vw-glibc-2.18/lib/libc.so.6 Thread 2 (Thread 0x7f275a29a700 (LWP 30824)): #0 re_node_set_insert (set=3D0x7f275a299500, elem=3D18) at regex_internal.= c:1284 #1 0x00007f275c928e53 in build_sifted_states (cur_dest=3D0x7f275a299500, s= tr_idx=3D30, sctx=3D0x7f275a299640, mctx=3D0x7f275a299680) at regexec.c:1733 #2 sift_states_backward (mctx=3Dmctx@entry=3D0x7f275a299680, sctx=3Dsctx@e= ntry=3D0x7f275a299640) at regexec.c:1662 #3 0x00007f275c929c6f in prune_impossible_nodes (mctx=3D0x7f275a299680) at= regexec.c:1036 #4 re_search_internal (preg=3Dpreg@entry=3D0x29b0e40,=20 string=3D0x7f274c0f6f80 "http://64109hydra.gnu.org/nar/0did57blsaaspj49= cl3q8nnydm5pr1qg-cflow-1.485412",=20 length=3Dlength@entry=3D77, start=3Dstart@entry=3D0, last_start=3D0, la= st_start@entry=3D77, stop=3Dstop@entry=3D77, nmatch=3D9,=20 pmatch=3D0x7f274c0f7ac0, eflags=3D0) at regexec.c:873 #5 0x00007f275c92e556 in rpl_regexec (preg=3D0x29b0e40,=20 string=3Dstring@entry=3D0x7f274c0f6f80 "http://64109hydra.gnu.org/nar/0= did57blsaaspj49cl3q8nnydm5pr1qg-cflow-1.485412",=20 nmatch=3Dnmatch@entry=3D9, pmatch=3Dpmatch@entry=3D0x7f274c0f7ac0, efla= gs=3D0) at regexec.c:252 #6 0x00007f275c91b473 in scm_regexp_exec (rx=3D0x29c8a50, str=3D0x2c36fa0,= start=3D<optimized out>, flags=3D0x2) at regex-posix.c:288 #7 0x00007f275c90f9f2 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x7f275cbac570 <scm_regexp_exec.subr_raw_cell>,=20 argv=3D<optimized out>, nargs=3D4) at vm-i-system.c:861 #8 0x00007f275c8f7b80 in really_launch (d=3D0x7fff4246a800) at threads.c:1= 005 #9 0x00007f275c87d7aa in c_body (d=3D0x7f275a299d70) at continuations.c:517 #10 0x00007f275c90fa28 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x26d0040, argv=3D<optimized out>, nargs=3D2) at vm-i-system.c:855 #11 0x00007f275c886fe3 in scm_call_4 (proc=3D0x27d8c30, arg1=3Darg1@entry= =3D0x404, arg2=3D<optimized out>, arg3=3D<optimized out>,=20 arg4=3D<optimized out>) at eval.c:507 #12 0x00007f275c8f9999 in scm_catch_with_pre_unwind_handler (key=3Dkey@entr= y=3D0x404, thunk=3D<optimized out>, handler=3D<optimized out>,=20 pre_unwind_handler=3D<optimized out>) at throw.c:73 #13 0x00007f275c8f9a9f in scm_c_catch (tag=3Dtag@entry=3D0x404, body=3Dbody= @entry=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f275a299d70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f275a299d70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>,=20 pre_unwind_handler_data=3Dpre_unwind_handler_data@entry=3D0x26d5040) at= throw.c:207 #14 0x00007f275c87deef in scm_i_with_continuation_barrier (body=3Dbody@entr= y=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f275a299d70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f275a299d70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>, pre_unwind_handler_data=3D0x26d5040) at continuations.c:455 #15 0x00007f275c87df85 in scm_c_with_continuation_barrier (func=3D<optimize= d out>, data=3D<optimized out>) at continuations.c:551 #16 0x00007f275c8f738c in with_guile_and_parent (base=3D0x7f275a299dd0, dat= a=3D0x7f275a299e00) at threads.c:906 #17 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #18 0x00007f275c8f6d4c in scm_i_with_guile_and_parent (parent=3D<optimized = out>, data=3D0x7fff4246a800,=20 func=3D0x7f275c8f7b00 <really_launch>) at threads.c:949 #19 launch_thread (d=3D0x7fff4246a800) at threads.c:1017 #20 0x00007f275c5d2ec3 in GC_inner_start_routine () from /nix/store/f072ihg= ps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #21 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #22 0x00007f275c39f052 in start_thread () from /nix/store/jwd1hc3i3pmnsxf23= 47r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #23 0x00007f275add3b7d in clone () from /nix/store/jwd1hc3i3pmnsxf2347r4k2c= 77nbr9vw-glibc-2.18/lib/libc.so.6 Thread 1 (Thread 0x7f27591f8700 (LWP 30826)): #0 0x00007f275c5cee7b in GC_build_fl4 () from /nix/store/f072ihgps3078d9l7= 1w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #1 0x00007f275c5cf085 in GC_new_hblk () from /nix/store/f072ihgps3078d9l71= w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #2 0x00007f275c5c4882 in GC_allocobj () from /nix/store/f072ihgps3078d9l71= w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #3 0x00007f275c5c9320 in GC_generic_malloc_inner () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #4 0x00007f275c5c93fd in GC_generic_malloc () from /nix/store/f072ihgps307= 8d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #5 0x00007f275c5c9689 in GC_core_malloc_atomic () from /nix/store/f072ihgp= s3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #6 0x00007f275c8ee3c4 in make_stringbuf (len=3D4) at strings.c:129 #7 0x00007f275c8efbf5 in scm_i_string_start_writing (orig_str=3D0x2c25360)= at strings.c:573 #8 0x00007f275c8e4ccf in string_downcase_x (v=3D<optimized out>, start=3Ds= tart@entry=3D0, end=3Dend@entry=3D4) at srfi-13.c:2169 #9 0x00007f275c8e50d8 in string_downcase_x (end=3D4, start=3D0, v=3D<optim= ized out>) at srfi-13.c:2167 #10 scm_substring_downcase (str=3D0x2c25380, start=3D<optimized out>, end= =3D<optimized out>) at srfi-13.c:2218 #11 0x00007f275c90fa0f in vm_regular_engine (vm=3D<optimized out>, program= =3D0x7f275cb9ef60 <scm_substring_downcase.subr_raw_cell>,=20 argv=3D<optimized out>, nargs=3D3) at vm-i-system.c:858 #12 0x00007f275c8f7b80 in really_launch (d=3D0x7fff4246a800) at threads.c:1= 005 #13 0x00007f275c87d7aa in c_body (d=3D0x7f27591f7d70) at continuations.c:517 #14 0x00007f275c90fa28 in vm_regular_engine (vm=3D<optimized out>, program= =3D0x26d0040, argv=3D<optimized out>, nargs=3D2) at vm-i-system.c:855 #15 0x00007f275c886fe3 in scm_call_4 (proc=3D0x27d8c30, arg1=3Darg1@entry= =3D0x404, arg2=3D<optimized out>, arg3=3D<optimized out>,=20 arg4=3D<optimized out>) at eval.c:507 #16 0x00007f275c8f9999 in scm_catch_with_pre_unwind_handler (key=3Dkey@entr= y=3D0x404, thunk=3D<optimized out>, handler=3D<optimized out>,=20 pre_unwind_handler=3D<optimized out>) at throw.c:73 #17 0x00007f275c8f9a9f in scm_c_catch (tag=3Dtag@entry=3D0x404, body=3Dbody= @entry=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f27591f7d70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f27591f7d70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>,=20 pre_unwind_handler_data=3Dpre_unwind_handler_data@entry=3D0x26d5040) at= throw.c:207 #18 0x00007f275c87deef in scm_i_with_continuation_barrier (body=3Dbody@entr= y=3D0x7f275c87d7a0 <c_body>,=20 body_data=3Dbody_data@entry=3D0x7f27591f7d70, handler=3Dhandler@entry= =3D0x7f275c87db80 <c_handler>,=20 handler_data=3Dhandler_data@entry=3D0x7f27591f7d70,=20 pre_unwind_handler=3Dpre_unwind_handler@entry=3D0x7f275c87d930 <pre_unw= ind_handler>, pre_unwind_handler_data=3D0x26d5040) at continuations.c:455 #19 0x00007f275c87df85 in scm_c_with_continuation_barrier (func=3D<optimize= d out>, data=3D<optimized out>) at continuations.c:551 #20 0x00007f275c8f738c in with_guile_and_parent (base=3D0x7f27591f7dd0, dat= a=3D0x7f27591f7e00) at threads.c:906 #21 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #22 0x00007f275c8f6d4c in scm_i_with_guile_and_parent (parent=3D<optimized = out>, data=3D0x7fff4246a800,=20 func=3D0x7f275c8f7b00 <really_launch>) at threads.c:949 #23 launch_thread (d=3D0x7fff4246a800) at threads.c:1017 #24 0x00007f275c5d2ec3 in GC_inner_start_routine () from /nix/store/f072ihg= ps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #25 0x00007f275c5ce172 in GC_call_with_stack_base () from /nix/store/f072ih= gps3078d9l71w6c7fz8vway2wy-libgc-7.2d/lib/libgc.so.1 #26 0x00007f275c39f052 in start_thread () from /nix/store/jwd1hc3i3pmnsxf23= 47r4k2c77nbr9vw-glibc-2.18/lib/libpthread.so.0 #27 0x00007f275add3b7d in clone () from /nix/store/jwd1hc3i3pmnsxf2347r4k2c= 77nbr9vw-glibc-2.18/lib/libc.so.6 --8<---------------cut here---------------end--------------->8--- Thanks, Ludo=E2=80=99.
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at 14404) by debbugs.gnu.org; 30 May 2013 07:30:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 30 03:30:38 2013 Received: from localhost ([127.0.0.1]:41515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UhxJk-0006pP-Hn for submit <at> debbugs.gnu.org; Thu, 30 May 2013 03:30:38 -0400 Received: from mail-ea0-f181.google.com ([209.85.215.181]:63332) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <paolo.bonzini@HIDDEN>) id 1UhxJh-0006p2-OF for 14404 <at> debbugs.gnu.org; Thu, 30 May 2013 03:30:34 -0400 Received: by mail-ea0-f181.google.com with SMTP id a11so6226188eae.40 for <14404 <at> debbugs.gnu.org>; Thu, 30 May 2013 00:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=PiBjnspKlTXw2dSwWnGaWsTfX9gXy70kTSQbraeV1/A=; b=u05mvmNEBt+gBZspjF9jBtfOXeZOa5KvsaQMWeeri0Jd04WtZKZdsQPUtft24tYeZK AfqKsxxHqP69uO3ZRM4B9TAB8UI2d8I/O9c1ThE1FP3LXINkEuwYLsA+VSkYUIquOMLL ncUZWmFUFBJmtHmWDKza31Ra01OSWVZqwyoIKtsZHG1UQiL7qODEECQRNYiA0z5sOMoe Y9cwRwRV//yh87FBdrmlxKP78mkRYhV1zf2CVInlnxIpD1m8rs6+P++UsJ3su/Rl/km7 lR4BIGf172eU9Mpd+X2xPjzS/yEWcdK82e2jTbBBT7PhVANn+wNpKCzsmnMcdXk86V5d blsw== X-Received: by 10.15.23.4 with SMTP id g4mr8741503eeu.107.1369898939882; Thu, 30 May 2013 00:28:59 -0700 (PDT) Received: from yakj.usersys.redhat.com (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id bo9sm44654995eeb.9.2013.05.30.00.28.57 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 00:28:58 -0700 (PDT) Message-ID: <51A6FFB0.4000004@HIDDEN> Date: Thu, 30 May 2013 09:28:48 +0200 From: Paolo Bonzini <bonzini@HIDDEN> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: Paul Eggert <eggert@HIDDEN> Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> <5199448F.9050608@HIDDEN> <87d2slu413.fsf@HIDDEN> <51A288AD.4070405@HIDDEN> <51A6A489.2060101@HIDDEN> In-Reply-To: <51A6A489.2060101@HIDDEN> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 14404 Cc: =?UTF-8?B?THVkb3ZpYyBDb3VydMOocw==?= <ludo@HIDDEN>, bug-gnulib@HIDDEN, 14404 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.6 (--) Il 30/05/2013 02:59, Paul Eggert ha scritto: > On 05/26/2013 03:11 PM, Paolo Bonzini wrote: >> Use the lock module instead. > > Adding the lock module should work. But this will require > some reengineering of Guile, so that Guile uses the lock module > rather than its own thread packaging. Another possibility, which > might be a bit simpler, would be for Guile to pretend to > have the lock module. It could do that by creating a file > glthread/lock.h that looks something like this: > > #include "../libguile/threads.h" > #define gl_lock_define(class, name) class scm_i_pthread_mutex_t name; > #define glthread_lock_init scm_i_pthread_mutex_init > #define glthread_lock_destroy scm_i_pthread_mutex_destroy > #define glthread_lock_lock scm_i_pthread_mutex_lock > #define glthread_lock_unlock scm_i_pthread_mutex_lock_unlock > > and by putting AC_DEFINE([GNULIB_LOCK]) into configure.ac. > Whatever, all I care about is gnulib code not reinventing the wheel and observing --disable-threads/gl_THREADLIB_DEFAULT_NO. Paolo
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at 14404) by debbugs.gnu.org; 30 May 2013 01:01:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 29 21:01:35 2013 Received: from localhost ([127.0.0.1]:41084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UhrFD-00071l-Nx for submit <at> debbugs.gnu.org; Wed, 29 May 2013 21:01:35 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:45668) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <eggert@HIDDEN>) id 1UhrF9-00071E-5p for 14404 <at> debbugs.gnu.org; Wed, 29 May 2013 21:01:28 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id ABDED39E8105; Wed, 29 May 2013 17:59:54 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tiVWTntWhtWY; Wed, 29 May 2013 17:59:53 -0700 (PDT) Received: from [192.168.1.9] (pool-71-108-49-126.lsanca.fios.verizon.net [71.108.49.126]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 60ADE39E8100; Wed, 29 May 2013 17:59:53 -0700 (PDT) Message-ID: <51A6A489.2060101@HIDDEN> Date: Wed, 29 May 2013 17:59:53 -0700 From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Paolo Bonzini <bonzini@HIDDEN> Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> <5199448F.9050608@HIDDEN> <87d2slu413.fsf@HIDDEN> <51A288AD.4070405@HIDDEN> In-Reply-To: <51A288AD.4070405@HIDDEN> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 14404 Cc: =?UTF-8?B?THVkb3ZpYyBDb3VydMOocw==?= <ludo@HIDDEN>, bug-gnulib@HIDDEN, 14404 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -5.3 (-----) On 05/26/2013 03:11 PM, Paolo Bonzini wrote: > Use the lock module instead. Adding the lock module should work. But this will require some reengineering of Guile, so that Guile uses the lock module rather than its own thread packaging. Another possibility, which might be a bit simpler, would be for Guile to pretend to have the lock module. It could do that by creating a file glthread/lock.h that looks something like this: #include "../libguile/threads.h" #define gl_lock_define(class, name) class scm_i_pthread_mutex_t name; #define glthread_lock_init scm_i_pthread_mutex_init #define glthread_lock_destroy scm_i_pthread_mutex_destroy #define glthread_lock_lock scm_i_pthread_mutex_lock #define glthread_lock_unlock scm_i_pthread_mutex_lock_unlock and by putting AC_DEFINE([GNULIB_LOCK]) into configure.ac.
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at 14404) by debbugs.gnu.org; 26 May 2013 22:13:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 26 18:13:24 2013 Received: from localhost ([127.0.0.1]:35811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UgjBr-0006i2-V7 for submit <at> debbugs.gnu.org; Sun, 26 May 2013 18:13:24 -0400 Received: from mail-ee0-f50.google.com ([74.125.83.50]:40844) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <paolo.bonzini@HIDDEN>) id 1UgjBp-0006hq-7L for 14404 <at> debbugs.gnu.org; Sun, 26 May 2013 18:13:22 -0400 Received: by mail-ee0-f50.google.com with SMTP id c41so3755477eek.9 for <14404 <at> debbugs.gnu.org>; Sun, 26 May 2013 15:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=OE7N1rcRTxe4FdtDhquCqE8QE4JtxB3sBPSw8rLWJbk=; b=Jbrr3lkLR3NW3pNikOVc5mHEFGt9zN18DblkcXrCJKK+U4QWSvil6+6l3+e1pclGFt uvKgq+2Chx8RW2w1JVTSW7Z5EEsfsNBaQdv49rPkghwRcOxqPdnpGz7U5JBa8WBnqBQK UYzKCKYVOJgaGOzAdMuPVMyO4Jt72KDhn/dIprGWlkF41jN2twqxCPnd2Fq+sqlUt2ko Vn0KBx1iNLkEaVhxOY3nhysim8CoeAtaBcq/tLnl+F55MwBXunxZ7/FgOrM9j6chvOV9 MkLNHqCWmaFqgnpbDfr5j48IKLluJm3dk+W4rBfc4aGlC1Wqpuv418TLJ8Io6d17nmwO e8Yg== X-Received: by 10.15.111.75 with SMTP id ci51mr51824366eeb.7.1369606326591; Sun, 26 May 2013 15:12:06 -0700 (PDT) Received: from yakj.usersys.redhat.com (net-37-117-138-128.cust.dsl.vodafone.it. [37.117.138.128]) by mx.google.com with ESMTPSA id c5sm22207021eeu.8.2013.05.26.15.12.03 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 26 May 2013 15:12:05 -0700 (PDT) Message-ID: <51A288AD.4070405@HIDDEN> Date: Mon, 27 May 2013 00:11:57 +0200 From: Paolo Bonzini <bonzini@HIDDEN> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: =?UTF-8?B?THVkb3ZpYyBDb3VydMOocw==?= <ludo@HIDDEN> Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> <5199448F.9050608@HIDDEN> <87d2slu413.fsf@HIDDEN> In-Reply-To: <87d2slu413.fsf@HIDDEN> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 14404 Cc: 14404 <at> debbugs.gnu.org, Paul Eggert <eggert@HIDDEN>, bug-gnulib@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.6 (--) Il 20/05/2013 16:20, Ludovic Courtès ha scritto: > Paul Eggert <eggert@HIDDEN> skribis: > >> On 05/14/2013 02:21 PM, Ludovic Courtès wrote: >> >>> How should that be fixed? Shouldn’t __libc_lock_unlock & co. be rebased >>> on top of pthread_mutex_t? >> >> Yes, thanks, that sounds right. I pushed the following patch into gnulib; >> could you please see whether it fixes the problem for you? It'd be >> helpful to try it on non-glibc systems too, if possible. > > Thank you for the quick reply. I haven’t tested yet, but I have a question: > >> --- a/modules/regex >> +++ b/modules/regex >> @@ -24,6 +24,7 @@ memmove [test $ac_use_included_regex = yes] >> mbrtowc [test $ac_use_included_regex = yes] >> mbsinit [test $ac_use_included_regex = yes] >> nl_langinfo [test $ac_use_included_regex = yes] >> +pthread [test $ac_use_included_regex = yes] >> stdbool [test $ac_use_included_regex = yes] >> stdint [test $ac_use_included_regex = yes] >> wchar [test $ac_use_included_regex = yes] > > Seems like this is going to add -lpthread to LDFLAGS, right? > > That would raise two issues: first, it should add -pthread to both > CFLAGS and LDFLAGS, not just -lpthread. > > Second, Guile can be compiled with and without thread support. In the > latter case, we wouldn’t want Gnulib to stealthily pull in pthreads. > How can this be addressed? Use the lock module instead. Paolo
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at 14404) by debbugs.gnu.org; 20 May 2013 14:20:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 20 10:20:48 2013 Received: from localhost ([127.0.0.1]:52979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UeQxD-0001hy-9q for submit <at> debbugs.gnu.org; Mon, 20 May 2013 10:20:47 -0400 Received: from xanadu.aquilenet.fr ([88.191.123.111]:45136) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <ludo@HIDDEN>) id 1UeQxA-0001hk-4j for 14404 <at> debbugs.gnu.org; Mon, 20 May 2013 10:20:46 -0400 Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 67ACDD51C; Mon, 20 May 2013 16:20:09 +0200 (CEST) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GzlJr3M5nJqQ; Mon, 20 May 2013 16:20:09 +0200 (CEST) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id D14F6D514; Mon, 20 May 2013 16:20:08 +0200 (CEST) From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Paul Eggert <eggert@HIDDEN> Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> <5199448F.9050608@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 Prairial an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Mon, 20 May 2013 16:20:08 +0200 In-Reply-To: <5199448F.9050608@HIDDEN> (Paul Eggert's message of "Sun, 19 May 2013 14:30:55 -0700") Message-ID: <87d2slu413.fsf@HIDDEN> User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 14404 Cc: 14404 <at> debbugs.gnu.org, bug-gnulib@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -1.2 (-) Paul Eggert <eggert@HIDDEN> skribis: > On 05/14/2013 02:21 PM, Ludovic Court=C3=A8s wrote: > >> How should that be fixed? Shouldn=E2=80=99t __libc_lock_unlock & co. be= rebased >> on top of pthread_mutex_t? > > Yes, thanks, that sounds right. I pushed the following patch into gnulib; > could you please see whether it fixes the problem for you? It'd be > helpful to try it on non-glibc systems too, if possible. Thank you for the quick reply. I haven=E2=80=99t tested yet, but I have a = question: > --- a/modules/regex > +++ b/modules/regex > @@ -24,6 +24,7 @@ memmove [test $ac_use_included_regex =3D yes] > mbrtowc [test $ac_use_included_regex =3D yes] > mbsinit [test $ac_use_included_regex =3D yes] > nl_langinfo [test $ac_use_included_regex =3D yes] > +pthread [test $ac_use_included_regex =3D yes] > stdbool [test $ac_use_included_regex =3D yes] > stdint [test $ac_use_included_regex =3D yes] > wchar [test $ac_use_included_regex =3D yes] Seems like this is going to add -lpthread to LDFLAGS, right? That would raise two issues: first, it should add -pthread to both CFLAGS and LDFLAGS, not just -lpthread. Second, Guile can be compiled with and without thread support. In the latter case, we wouldn=E2=80=99t want Gnulib to stealthily pull in pthreads. How can this be addressed? Thanks! Ludo=E2=80=99.
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at submit) by debbugs.gnu.org; 19 May 2013 21:32:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 19 17:32:06 2013 Received: from localhost ([127.0.0.1]:51867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UeBD4-0001Lk-4l for submit <at> debbugs.gnu.org; Sun, 19 May 2013 17:32:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44016) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <eggert@HIDDEN>) id 1UeBCz-0001L3-SI for submit <at> debbugs.gnu.org; Sun, 19 May 2013 17:32:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eggert@HIDDEN>) id 1UeBCP-0007K2-MX for submit <at> debbugs.gnu.org; Sun, 19 May 2013 17:31:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-103.4 required=5.0 tests=BAYES_20, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:40310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eggert@HIDDEN>) id 1UeBCP-0007Js-IS for submit <at> debbugs.gnu.org; Sun, 19 May 2013 17:31:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <eggert@HIDDEN>) id 1UeBCE-0002ma-2D for bug-guile@HIDDEN; Sun, 19 May 2013 17:31:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eggert@HIDDEN>) id 1UeBC1-00079G-Ur for bug-guile@HIDDEN; Sun, 19 May 2013 17:31:13 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:39192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eggert@HIDDEN>) id 1UeBBw-00073S-Qn; Sun, 19 May 2013 17:30:57 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id EA0B2A60001; Sun, 19 May 2013 14:30:55 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CV6fCDbNmoKc; Sun, 19 May 2013 14:30:55 -0700 (PDT) Received: from [192.168.1.2] (pool-71-108-49-126.lsanca.fios.verizon.net [71.108.49.126]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3BC8C39E8108; Sun, 19 May 2013 14:30:55 -0700 (PDT) Message-ID: <5199448F.9050608@HIDDEN> Date: Sun, 19 May 2013 14:30:55 -0700 From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: =?UTF-8?B?THVkb3ZpYyBDb3VydMOocw==?= <ludo@HIDDEN> Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> In-Reply-To: <87ehd9i7fc.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit Cc: bug-guile@HIDDEN, bug-gnulib@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -6.2 (------) On 05/14/2013 02:21 PM, Ludovic Court=C3=A8s wrote: > How should that be fixed? Shouldn=E2=80=99t __libc_lock_unlock & co. b= e rebased > on top of pthread_mutex_t? Yes, thanks, that sounds right. I pushed the following patch into gnulib= ; could you please see whether it fixes the problem for you? It'd be helpful to try it on non-glibc systems too, if possible. --- ChangeLog | 19 +++++++++++++++++++ lib/regcomp.c | 11 ++++++++--- lib/regex_internal.h | 23 +++++++++++++++++------ lib/regexec.c | 4 ---- modules/regex | 1 + 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08042c5..35b6dd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2013-05-19 Paul Eggert <eggert@HIDDEN> =20 + regex: fix dfa race in multithreaded uses + Problem reported by Ludovic Court=C3=A8s in + <http://lists.gnu.org/archive/html/bug-gnulib/2013-05/msg00058.html>. + * lib/regex_internal.h (lock_define, lock_init, lock_fini): + New macros. All uses of __libc_lock_define, __libc_lock_init + changed to use the first two of these. + (__libc_lock_lock, __libc_lock_unlock): New macros, for + non-glibc platforms. + (struct re_dfa_t): Define the lock unconditionally. + * lib/regexec.c (regexec, re_search_stub): Remove some now-incorrect + '#ifdef _LIBC"s. + * modules/regex (Depends-on): Add pthread, if we use the + included regex. + + * lib/regcomp.c: Do actions that are not needed for glibc, + but may be needed elsewhere. + (regfree, re_compile_internal): Destroy the lock. + (re_compile_internal): Check for lock-initialization failure. + malloca: port to compilers that reject size-zero arrays This fixes a bug introduced in my previous patch. * lib/malloca.c (struct preliminary_header): Use an int diff --git a/lib/regcomp.c b/lib/regcomp.c index 4a8485e..5344381 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -663,7 +663,10 @@ regfree (preg) { re_dfa_t *dfa =3D preg->buffer; if (BE (dfa !=3D NULL, 1)) - free_dfa_content (dfa); + { + lock_fini (dfa->lock); + free_dfa_content (dfa); + } preg->buffer =3D NULL; preg->allocated =3D 0; =20 @@ -784,6 +787,8 @@ re_compile_internal (regex_t *preg, const char * patt= ern, size_t length, preg->used =3D sizeof (re_dfa_t); =20 err =3D init_dfa (dfa, length); + if (BE (err =3D=3D REG_NOERROR && lock_init (dfa->lock) !=3D 0, 0)) + err =3D REG_ESPACE; if (BE (err !=3D REG_NOERROR, 0)) { free_dfa_content (dfa); @@ -797,8 +802,6 @@ re_compile_internal (regex_t *preg, const char * patt= ern, size_t length, strncpy (dfa->re_str, pattern, length + 1); #endif =20 - __libc_lock_init (dfa->lock); - err =3D re_string_construct (®exp, pattern, length, preg->translate= , (syntax & RE_ICASE) !=3D 0, dfa); if (BE (err !=3D REG_NOERROR, 0)) @@ -806,6 +809,7 @@ re_compile_internal (regex_t *preg, const char * patt= ern, size_t length, re_compile_internal_free_return: free_workarea_compile (preg); re_string_destruct (®exp); + lock_fini (dfa->lock); free_dfa_content (dfa); preg->buffer =3D NULL; preg->allocated =3D 0; @@ -838,6 +842,7 @@ re_compile_internal (regex_t *preg, const char * patt= ern, size_t length, =20 if (BE (err !=3D REG_NOERROR, 0)) { + lock_fini (dfa->lock); free_dfa_content (dfa); preg->buffer =3D NULL; preg->allocated =3D 0; diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 439444c..63a9979 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -32,12 +32,25 @@ #include <wctype.h> #include <stdbool.h> #include <stdint.h> + #if defined _LIBC # include <bits/libc-lock.h> +#endif +/* Use __libc_lock_define (, NAME) if the library defines the macro, + and if the compiler is known to support empty macro arguments. */ +#if (defined __libc_lock_define = \ + && ((defined __GNUC__ && !defined __STRICT_ANSI__) = \ + || (defined __STDC_VERSION__ && 199901L <=3D __STDC_VERSION__))= ) +# define lock_define(name) __libc_lock_define (, name) +# define lock_init(lock) (__libc_lock_init (lock), 0) +# define lock_fini(lock) 0 #else -# define __libc_lock_init(NAME) do { } while (0) -# define __libc_lock_lock(NAME) do { } while (0) -# define __libc_lock_unlock(NAME) do { } while (0) +# include <pthread.h> +# define lock_define(name) pthread_mutex_t name; +# define lock_init(lock) pthread_mutex_init (&(lock), 0) +# define lock_fini(lock) pthread_mutex_destroy (&(lock)) +# define __libc_lock_lock(lock) pthread_mutex_lock (&(lock)) +# define __libc_lock_unlock(lock) pthread_mutex_unlock (&(lock)) #endif =20 /* In case that the system doesn't have isblank(). */ @@ -698,9 +711,7 @@ struct re_dfa_t #ifdef DEBUG char* re_str; #endif -#ifdef _LIBC - __libc_lock_define (, lock) -#endif + lock_define (lock) }; =20 #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_s= et)) diff --git a/lib/regexec.c b/lib/regexec.c index 09c3eec..114287e 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -228,9 +228,7 @@ regexec (preg, string, nmatch, pmatch, eflags) { reg_errcode_t err; Idx start, length; -#ifdef _LIBC re_dfa_t *dfa =3D preg->buffer; -#endif =20 if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) return REG_BADPAT; @@ -421,9 +419,7 @@ re_search_stub (struct re_pattern_buffer *bufp, Idx nregs; regoff_t rval; int eflags =3D 0; -#ifdef _LIBC re_dfa_t *dfa =3D bufp->buffer; -#endif Idx last_start =3D start + range; =20 /* Check for out-of-range. */ diff --git a/modules/regex b/modules/regex index 8f5eda0..2dbb777 100644 --- a/modules/regex +++ b/modules/regex @@ -24,6 +24,7 @@ memmove [test $ac_use_included_regex =3D yes] mbrtowc [test $ac_use_included_regex =3D yes] mbsinit [test $ac_use_included_regex =3D yes] nl_langinfo [test $ac_use_included_regex =3D yes] +pthread [test $ac_use_included_regex =3D yes] stdbool [test $ac_use_included_regex =3D yes] stdint [test $ac_use_included_regex =3D yes] wchar [test $ac_use_included_regex =3D yes] --=20 1.7.11.7
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at 14404) by debbugs.gnu.org; 15 May 2013 07:34:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 15 03:34:15 2013 Received: from localhost ([127.0.0.1]:45195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UcWDz-0005Ep-O6 for submit <at> debbugs.gnu.org; Wed, 15 May 2013 03:34:12 -0400 Received: from xanadu.aquilenet.fr ([88.191.123.111]:43318) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <ludo@HIDDEN>) id 1UcWDw-0005EU-Ly for 14404 <at> debbugs.gnu.org; Wed, 15 May 2013 03:34:09 -0400 Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 10235D5DA for <14404 <at> debbugs.gnu.org>; Wed, 15 May 2013 09:34:04 +0200 (CEST) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uaeo0MNlmnwk for <14404 <at> debbugs.gnu.org>; Wed, 15 May 2013 09:34:03 +0200 (CEST) Received: from pluto (pluto.sophia.inria.fr [138.96.204.192]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id C2D11D5D9 for <14404 <at> debbugs.gnu.org>; Wed, 15 May 2013 09:34:03 +0200 (CEST) From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: 14404 <at> debbugs.gnu.org Subject: Re: regexp_exec thread-unsafe References: <87ehd9i7fc.fsf@HIDDEN> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 =?utf-8?Q?Flor=C3=A9al?= an 221 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Wed, 15 May 2013 09:34:03 +0200 In-Reply-To: <87ehd9i7fc.fsf@HIDDEN> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 14 May 2013 23:21:43 +0200") Message-ID: <87fvxoofx0.fsf@HIDDEN> User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 14404 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -1.2 (-) And here=E2=80=99s a reduced test case that =E2=80=9Cworks=E2=80=9D quite w= ell on Guile 2.0.9: --8<---------------cut here---------------start------------->8--- (use-modules (ice-9 threads) (ice-9 regex) (web uri) (srfi srfi-1) (srfi srfi-26)) (let ((do-regexps (lambda () (define seed1 (random 100000)) (define seed2 (random 100000)) (let loop () (let ((p (make-regexp "^http://([^/]+)/(.*)$")) (s (string-append "http://" (number->string seed1) "hydra.gnu.org/nar/0did57blsaaspj49cl3q8nny= dm5pr1qg-cflow-1.4" (number->string seed2)))) (or (uri? (string->uri s)) (exit 42)) (regexp-exec p s) (loop)))))) (unfold (cute >=3D <> (current-processor-count)) (lambda (i) (call-with-new-thread do-regexps)) 1+ 0) (do-regexps)) --8<---------------cut here---------------end--------------->8--- Ludo=E2=80=99.
bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.Received: (at submit) by debbugs.gnu.org; 14 May 2013 21:22:13 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 14 17:22:13 2013 Received: from localhost ([127.0.0.1]:44640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1UcMfk-0002qa-U7 for submit <at> debbugs.gnu.org; Tue, 14 May 2013 17:22:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56304) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <ludo@HIDDEN>) id 1UcMfh-0002q2-PJ for submit <at> debbugs.gnu.org; Tue, 14 May 2013 17:22:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <ludo@HIDDEN>) id 1UcMfZ-0001qA-SC for submit <at> debbugs.gnu.org; Tue, 14 May 2013 17:22:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-98.4 required=5.0 tests=BAYES_50,RDNS_NONE, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:53909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>) id 1UcMfZ-0001q1-PV for submit <at> debbugs.gnu.org; Tue, 14 May 2013 17:22:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>) id 1UcMfY-0007Oa-Cv for bug-guile@HIDDEN; Tue, 14 May 2013 17:22:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <ludo@HIDDEN>) id 1UcMfW-0001pF-O9 for bug-guile@HIDDEN; Tue, 14 May 2013 17:22:00 -0400 Received: from [2a01:e0b:1:123:ca0a:a9ff:fe03:271e] (port=49361 helo=xanadu.aquilenet.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>) id 1UcMfT-0001nf-Gf; Tue, 14 May 2013 17:21:55 -0400 Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id D4D54D40A; Tue, 14 May 2013 23:21:45 +0200 (CEST) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CPJViD90TjCM; Tue, 14 May 2013 23:21:45 +0200 (CEST) Received: from pluto (40.129.10.93.rev.sfr.net [93.10.129.40]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id CA255CADB; Tue, 14 May 2013 23:21:44 +0200 (CEST) From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: bug-gnulib@HIDDEN Subject: regexp_exec thread-unsafe X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 =?utf-8?Q?Flor=C3=A9al?= an 221 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Tue, 14 May 2013 23:21:43 +0200 Message-ID: <87ehd9i7fc.fsf@HIDDEN> User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: submit Cc: bug-guile@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -7.5 (-------) Hello, Guile imports Gnulib =E2=80=98regexp=E2=80=99 module, and for some reason i= t gets compiled even on glibc systems. The problem is that Gnulib=E2=80=99s =E2=80=98regex_internal.h=E2=80=99 rea= ds this: #if defined _LIBC # include <bits/libc-lock.h> #else # define __libc_lock_init(NAME) do { } while (0) # define __libc_lock_lock(NAME) do { } while (0) # define __libc_lock_unlock(NAME) do { } while (0) #endif and =E2=80=98regexp_exec=E2=80=99 happily does: __libc_lock_lock (dfa->lock); if (preg->no_sub) err =3D re_search_internal (preg, string, length, start, length, length, 0, NULL, eflags); else err =3D re_search_internal (preg, string, length, start, length, length, nmatch, pmatch, eflags); __libc_lock_unlock (dfa->lock); Obviously that doesn=E2=80=99t work well, and it caused a regression in Gui= le. With MALLOC_CHECK_=3D2 and a Guile program, it aborts like this (sorry, I failed to come up with a reduced test case): --8<---------------cut here---------------start------------->8--- (gdb) bt full #0 0x00007f793608d2b5 in raise () from /home/ludo/.guix-profile/lib/libc.s= o.6 No symbol table info available. #1 0x00007f793608e738 in abort () from /home/ludo/.guix-profile/lib/libc.s= o.6 No symbol table info available. #2 0x00007f79360d2afe in malloc_printerr () from /home/ludo/.guix-profile/= lib/libc.so.6 No symbol table info available. #3 0x00007f79360d5bf5 in realloc_check () from /home/ludo/.guix-profile/li= b/libc.so.6 No symbol table info available. #4 0x00007f7937a6efed in register_state (dfa=3D0x10872c0, newstate=3Dnewst= ate@entry=3D0x1c6dce0, hash=3Dhash@entry=3D576) at regex_internal.c:1590 new_alloc =3D 8 new_array =3D 0x0 spot =3D 0x11981c0 i =3D <optimized out> #5 0x00007f7937a72373 in create_cd_newstate (hash=3D<optimized out>, conte= xt=3D1, nodes=3D0x12, dfa=3D0x1c6dce0) at regex_internal.c:1734 i =3D <optimized out> nctx_nodes =3D <optimized out> err =3D <optimized out> newstate =3D 0x1c6dce0 #6 re_acquire_state_context (err=3Derr@entry=3D0x7fff67bd9e40, dfa=3Ddfa@e= ntry=3D0x10872c0, nodes=3Dnodes@entry=3D0x7fff67bd9e60,=20 context=3Dcontext@entry=3D1) at regex_internal.c:1554 hash =3D 6 spot =3D <optimized out> i =3D <optimized out> #7 0x00007f79379bb54b in build_trtable (dfa=3D<optimized out>, state=3Dsta= te@entry=3D0x1c44820) at regexec.c:3474 next_node =3D <optimized out> err =3D _REG_NOERROR i =3D 1 j =3D 2 ch =3D <optimized out> need_word_trtable =3D true elem =3D <optimized out> mask =3D <optimized out> dests_node_malloced =3D true dest_states_malloced =3D true trtable =3D <optimized out> dest_states =3D 0x1c688f0 dest_states_word =3D 0x1c68918 dest_states_nl =3D 0x1c68940 follows =3D {alloc =3D 74, nelem =3D 18, elems =3D 0x1c5d4e0} dests_node =3D 0x1c642b0 dests_ch =3D 0x1c65ab0 acceptable =3D {288063250384289792, 576460743847706622, 0, 0} dests_alloc =3D 0x1c642b0 #8 0x00007f7937a77714 in transit_state (state=3D0x1c44820, mctx=3D0x7fff67= bda000, err=3D0x7fff67bd9fb0) at regexec.c:2339 trtable =3D <optimized out> ch =3D 116 't' #9 check_matching (p_match_first=3D0x7fff67bd9fb8, fl_longest_match=3Dtrue= , mctx=3D0x7fff67bda000) at regexec.c:1187 old_state =3D 0x1c44820 next_char_idx =3D <optimized out> dfa =3D <optimized out> err =3D _REG_NOERROR match =3D 0 match_last =3D <optimized out> next_start_idx =3D 0 cur_str_idx =3D <optimized out> cur_state =3D 0x1c44820 at_init_state =3D <optimized out> #10 re_search_internal (preg=3D0x1256700, string=3D0x1c612d0 "http://hydra.= gnu.org/nar/0did57blsaaspj49cl3q8nnydm5pr1qg-cflow-1.4",=20 length=3D67, start=3D0, last_start=3D0, stop=3D<optimized out>, nmatch= =3D9, pmatch=3D0x1c63d50, eflags=3D0) at regexec.c:856 err =3D _REG_NOERROR dfa =3D 0x10872c0 left_lim =3D 0 right_lim =3D 0 incr =3D 1 fl_longest_match =3D <optimized out> match_kind =3D 8 match_first =3D 0 match_last =3D <optimized out> extra_nmatch =3D 0 sb =3D false mctx =3D {input =3D {raw_mbs =3D 0x1c612d0 "http://hydra.gnu.org/na= r/0did57blsaaspj49cl3q8nnydm5pr1qg-cflow-1.4",=20 mbs =3D 0x1c612d0 "http://hydra.gnu.org/nar/0did57blsaaspj49cl3= q8nnydm5pr1qg-cflow-1.4", wcs =3D 0x1c63f50,=20 offsets =3D 0x0, cur_state =3D {__count =3D 0, __value =3D {__w= ch =3D 0, __wchb =3D "\000\000\000"}}, raw_mbs_idx =3D 0,=20 valid_len =3D 67, valid_raw_len =3D 67, bufs_len =3D 68, cur_id= x =3D 2, raw_len =3D 67, len =3D 67, raw_stop =3D 67, stop =3D 67,=20 tip_context =3D 6, trans =3D 0x0, word_char =3D 0x1087378, icas= e =3D 0 '\000', is_utf8 =3D 1 '\001', map_notascii =3D 0 '\000',=20 mbs_allocated =3D 0 '\000', offsets_needed =3D 0 '\000', newlin= e_anchor =3D 0 '\000', word_ops_used =3D 0 '\000',=20 mb_cur_max =3D 6}, dfa =3D 0x10872c0, eflags =3D 0, match_last = =3D 18446744073709551615, last_node =3D 0,=20 state_log =3D 0x1c64070, state_log_top =3D 1, nbkref_ents =3D 0, = abkref_ents =3D 0, bkref_ents =3D 0x0, max_mb_elem_len =3D 0,=20 nsub_tops =3D 0, asub_tops =3D 0, sub_tops =3D 0x0} fastmap =3D 0x0 t =3D 0x0 #11 0x00007f7937a7b5c0 in rpl_regexec (preg=3D0x1256700, string=3D0x3399 <A= ddress 0x3399 out of bounds>,=20 string@entry=3D0x1c612d0 "http://hydra.gnu.org/nar/0did57blsaaspj49cl3q= 8nnydm5pr1qg-cflow-1.4", nmatch=3D6, nmatch@entry=3D9,=20 pmatch=3D0xffffffffffffffff, pmatch@entry=3D0x1c63d50, eflags=3D0) at r= egexec.c:254 err =3D _REG_NOERROR start =3D 13209 length =3D 0 #12 0x00007f7937a68873 in scm_regexp_exec (rx=3D0x1836090, str=3D0x1806b00,= start=3D<optimized out>, flags=3D0x2) at regex-posix.c:288 status =3D <optimized out> nmatches =3D 9 offset =3D 0 matches =3D 0x1c63d50 c_str =3D 0x1c612d0 "http://hydra.gnu.org/nar/0did57blsaaspj49cl3q8= nnydm5pr1qg-cflow-1.4" mvec =3D 0x4 substr =3D <optimized out> --8<---------------cut here---------------end--------------->8--- How should that be fixed? Shouldn=E2=80=99t __libc_lock_unlock & co. be re= based on top of pthread_mutex_t? Thanks, Ludo=E2=80=99.
ludo@HIDDEN (Ludovic Courtès)
:bug-guile@HIDDEN
.
Full text available.bug-guile@HIDDEN
:bug#14404
; Package guile
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.