From unknown Mon Jun 23 05:59:27 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#20209 <20209@debbugs.gnu.org> To: bug#20209 <20209@debbugs.gnu.org> Subject: Status: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports Reply-To: bug#20209 <20209@debbugs.gnu.org> Date: Mon, 23 Jun 2025 12:59:27 +0000 retitle 20209 GUILE 2.0.11: crash in set_port_filename_x for bytevector por= ts reassign 20209 guile submitter 20209 David Kastrup severity 20209 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 26 16:18:45 2015 Received: (at submit) by debbugs.gnu.org; 26 Mar 2015 20:18:45 +0000 Received: from localhost ([127.0.0.1]:37592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbEEn-0003K4-0u for submit@debbugs.gnu.org; Thu, 26 Mar 2015 16:18:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52026) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbEEl-0003Jr-57 for submit@debbugs.gnu.org; Thu, 26 Mar 2015 16:18:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbEEe-0004Gz-Pp for submit@debbugs.gnu.org; Thu, 26 Mar 2015 16:18:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbEEe-0004Go-ND for submit@debbugs.gnu.org; Thu, 26 Mar 2015 16:18:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbEEd-0007gm-GH for bug-guile@gnu.org; Thu, 26 Mar 2015 16:18:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbEEb-0004F4-DB for bug-guile@gnu.org; Thu, 26 Mar 2015 16:18:35 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbEEb-0004Ev-A4 for bug-guile@gnu.org; Thu, 26 Mar 2015 16:18:33 -0400 Received: from localhost ([127.0.0.1]:40756 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbEEa-0007NB-NG for bug-guile@gnu.org; Thu, 26 Mar 2015 16:18:32 -0400 Received: by lola (Postfix, from userid 1000) id 2C66EE0CAC; Thu, 26 Mar 2015 21:18:23 +0100 (CET) From: David Kastrup To: bug-guile@gnu.org Subject: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports Date: Thu, 26 Mar 2015 21:18:23 +0100 Message-ID: <87fv8r1pio.fsf@fencepost.gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain The following code --=-=-= Content-Type: text/x-csrc Content-Disposition: inline; filename=nextbug.c #include int main() { scm_init_guile (); SCM str = scm_c_make_bytevector (0); SCM port = scm_open_bytevector_input_port (str, SCM_UNDEFINED); scm_set_port_filename_x (port, scm_from_locale_string ("/usr/local/tmp/lilypond/ly/init.ly")); return 0; } --=-=-= Content-Type: text/plain crashes with the backtrace Program terminated with signal SIGSEGV, Segmentation fault. #0 0xb7699059 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 (gdb) bt #0 0xb7699059 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 #1 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 #2 0xb7699153 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 #3 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 #4 0xb7699153 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 #5 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 #6 0xb7698ec9 in scm_prin1 () from /usr/lib/libguile-2.0.so.22 #7 0xb769a606 in scm_simple_format () from /usr/lib/libguile-2.0.so.22 #8 0xb76e5f0b in ?? () from /usr/lib/libguile-2.0.so.22 #9 0xb76e6539 in ?? () from /usr/lib/libguile-2.0.so.22 #10 0xb76e664c in scm_call_with_vm () from /usr/lib/libguile-2.0.so.22 #11 0xb764cc67 in scm_apply () from /usr/lib/libguile-2.0.so.22 #12 0xb764e90e in scm_apply_1 () from /usr/lib/libguile-2.0.so.22 #13 0xb76cdb7b in scm_throw () from /usr/lib/libguile-2.0.so.22 #14 0xb76ce04c in scm_ithrow () from /usr/lib/libguile-2.0.so.22 #15 0xb764b6a3 in scm_error_scm () from /usr/lib/libguile-2.0.so.22 #16 0xb764b778 in scm_error () from /usr/lib/libguile-2.0.so.22 #17 0xb764ba22 in scm_wrong_type_arg () from /usr/lib/libguile-2.0.so.22 #18 0xb76927ca in scm_set_port_filename_x () from /usr/lib/libguile-2.0.so.22 #19 0x08048723 in main () at nextbug.c:8 after outputting guile: uncaught throw to wrong-type-arg: (set-port-filename! Wrong type argument in position ~A: ~S (1 (Segmentation fault (core dumped) (by the way: what's up with the non-call of format here? It's not the first time I see wrong-type-arg spitting out a format string unmodified) Compilation was done using gcc -Wall -ggdb `guile-config compile` nextbug.c `guile-config link` -o nextbug Version is gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1 platform is Linux version 3.16.0-33-generic (buildd@brownie) (gcc version 4.9.1 (Ubuntu 4.9.1-16ubuntu6) ) #44-Ubuntu SMP Thu Mar 12 12:25:57 UTC 2015 A few simple experiments for triggering the same crash from Scheme rather than C were not successful. That does not necessarily mean much. It's not hard to guess that this is yet another roadblock on the way to get LilyPond working with GUILE2. Any ideas regarding what may be causing this error and how to work around it? -- David Kastrup --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 26 19:02:00 2015 Received: (at 20209) by debbugs.gnu.org; 26 Mar 2015 23:02:00 +0000 Received: from localhost ([127.0.0.1]:37684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbGml-00005E-FT for submit@debbugs.gnu.org; Thu, 26 Mar 2015 19:01:59 -0400 Received: from world.peace.net ([50.252.239.5]:38849 ident=hope9) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbGme-00004z-0r for 20209@debbugs.gnu.org; Thu, 26 Mar 2015 19:01:57 -0400 Received: from [10.1.10.78] (helo=jojen) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1YbGmW-00039a-Aj; Thu, 26 Mar 2015 19:01:44 -0400 From: Mark H Weaver To: David Kastrup Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> Date: Thu, 26 Mar 2015 19:02:15 -0400 In-Reply-To: <87fv8r1pio.fsf@fencepost.gnu.org> (David Kastrup's message of "Thu, 26 Mar 2015 21:18:23 +0100") Message-ID: <87egob8irs.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20209 Cc: 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) David Kastrup writes: > The following code > > > #include > > int main() > { > scm_init_guile (); > SCM str = scm_c_make_bytevector (0); > SCM port = scm_open_bytevector_input_port (str, SCM_UNDEFINED); > scm_set_port_filename_x (port, scm_from_locale_string ("/usr/local/tmp/lilypond/ly/init.ly")); > return 0; > } > > > crashes with the backtrace > > Program terminated with signal SIGSEGV, Segmentation fault. > #0 0xb7699059 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 > (gdb) bt > #0 0xb7699059 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 > #1 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 > #2 0xb7699153 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 > #3 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 > #4 0xb7699153 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 > #5 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 > #6 0xb7698ec9 in scm_prin1 () from /usr/lib/libguile-2.0.so.22 > #7 0xb769a606 in scm_simple_format () from /usr/lib/libguile-2.0.so.22 > #8 0xb76e5f0b in ?? () from /usr/lib/libguile-2.0.so.22 > #9 0xb76e6539 in ?? () from /usr/lib/libguile-2.0.so.22 > #10 0xb76e664c in scm_call_with_vm () from /usr/lib/libguile-2.0.so.22 > #11 0xb764cc67 in scm_apply () from /usr/lib/libguile-2.0.so.22 > #12 0xb764e90e in scm_apply_1 () from /usr/lib/libguile-2.0.so.22 > #13 0xb76cdb7b in scm_throw () from /usr/lib/libguile-2.0.so.22 > #14 0xb76ce04c in scm_ithrow () from /usr/lib/libguile-2.0.so.22 > #15 0xb764b6a3 in scm_error_scm () from /usr/lib/libguile-2.0.so.22 > #16 0xb764b778 in scm_error () from /usr/lib/libguile-2.0.so.22 > #17 0xb764ba22 in scm_wrong_type_arg () from /usr/lib/libguile-2.0.so.22 > #18 0xb76927ca in scm_set_port_filename_x () from /usr/lib/libguile-2.0.so.22 > #19 0x08048723 in main () at nextbug.c:8 > > after outputting > > guile: uncaught throw to wrong-type-arg: (set-port-filename! Wrong > type argument in position ~A: ~S (1 (Segmentation fault (core dumped) The problem turns out to be that binary ports are not initialized until the (ice-9 binary-ports) module is loaded. As a result, the port returned by 'scm_open_bytevector_input_port' has a bad type tag. The workaround is to call scm_c_resolve_module ("ice-9 binary-ports") after initializing Guile before the first call to 'scm_open_bytevector_input_port'. The following code works: --8<---------------cut here---------------start------------->8--- #include int main() { scm_init_guile (); (void) scm_c_resolve_module ("ice-9 binary-ports"); SCM str = scm_c_make_bytevector (0); SCM port = scm_open_bytevector_input_port (str, SCM_UNDEFINED); scm_set_port_filename_x (port, scm_from_locale_string ("/usr/local/tmp/lilypond/ly/init.ly")); return 0; } --8<---------------cut here---------------end--------------->8--- Mark From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 27 04:19:16 2015 Received: (at 20209) by debbugs.gnu.org; 27 Mar 2015 08:19:16 +0000 Received: from localhost ([127.0.0.1]:37799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbPU3-00054U-MX for submit@debbugs.gnu.org; Fri, 27 Mar 2015 04:19:16 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:59760 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbPU0-00054K-Sj for 20209@debbugs.gnu.org; Fri, 27 Mar 2015 04:19:13 -0400 Received: from localhost ([127.0.0.1]:38833 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbPTz-0006bN-QB; Fri, 27 Mar 2015 04:19:12 -0400 Received: by lola (Postfix, from userid 1000) id A9932E0CAC; Fri, 27 Mar 2015 09:18:48 +0100 (CET) From: David Kastrup To: Mark H Weaver Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> Date: Fri, 27 Mar 2015 09:18:48 +0100 In-Reply-To: <87egob8irs.fsf@netris.org> (Mark H. Weaver's message of "Thu, 26 Mar 2015 19:02:15 -0400") Message-ID: <87bnje26qf.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 20209 Cc: 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mark H Weaver writes: > The problem turns out to be that binary ports are not initialized until > the (ice-9 binary-ports) module is loaded. As a result, the port > returned by 'scm_open_bytevector_input_port' has a bad type tag. > > The workaround is to call scm_c_resolve_module ("ice-9 binary-ports") > after initializing Guile before the first call to > 'scm_open_bytevector_input_port'. It kind of defeats the point of having scm_open_bytevector_input_port in the C library part if you have to call scm_c_resolve_module before use. It's also a rather inscrutable error symptom. Any chance wrong-type-arg can guard against uninitialized/invalid types specifically? There is a reasonably high chance that bad/uninitialized SCM will wash up there. The more thorough way would be to check the type tag to be in valid range before doing any smob callback. -- David Kastrup From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 28 14:20:40 2015 Received: (at 20209) by debbugs.gnu.org; 28 Mar 2015 18:20:40 +0000 Received: from localhost ([127.0.0.1]:39066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbvLc-00073r-4r for submit@debbugs.gnu.org; Sat, 28 Mar 2015 14:20:40 -0400 Received: from world.peace.net ([50.252.239.5]:47413 ident=hope3) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbvLZ-00073h-TO for 20209@debbugs.gnu.org; Sat, 28 Mar 2015 14:20:39 -0400 Received: from [10.1.10.78] (helo=jojen) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1YbvLR-0007OM-DL; Sat, 28 Mar 2015 14:20:29 -0400 From: Mark H Weaver To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=), David Kastrup Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> Date: Sat, 28 Mar 2015 14:21:00 -0400 In-Reply-To: <87egob8irs.fsf@netris.org> (Mark H. Weaver's message of "Thu, 26 Mar 2015 19:02:15 -0400") Message-ID: <87y4mhasqb.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20209 Cc: 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Hi Ludovic, There's a problem with the C interfaces for bytevectors and binary ports, introduced in 1ee2c72eafaae5f91f4c899bc4b4853af5c16f28. Neither of those modules are initialized until the associated Scheme modules are loaded, but this is not documented. There are undocumented public C API functions 'scm_init_r6rs_ports' and 'scm_init_bytevectors', but if they are called and the associated Scheme modules (rnrs bytevectors) or (ice-9 binary-ports) are also loaded, then those initialization functions will be called more than once. In the case of 'scm_init_r6rs_ports', the duplicate initialization would cause 'scm_make_port_type' to be called more than once, leading to multiple copies of the same port types to be created. The snarfed code in r6rs-ports.x and bytevectors.x would also be run more than once. I don't know whether these duplicate initializations would cause problems, but it seems like a bad idea. Another issue is that 'scm_init_r6rs_ports' does not call 'scm_init_bytevectors', and yet that module calls C functions from bytevectors.c. For these reasons, I decided against recommending those undocumented initialization functions. Instead, I suggested that David initialize binary ports by loading (ice-9 binary-ports): (void) scm_c_resolve_module ("ice-9 binary-ports"); For Guile 2.0.12, I suggest that we unconditionally do the equivalent of 'scm_init_bytevectors' and 'scm_init_r6rs_ports' during Guile initialization, and make those functions into deprecated no-ops. What do you think? Mark Mark H Weaver writes: > David Kastrup writes: > >> The following code >> >> >> #include >> >> int main() >> { >> scm_init_guile (); >> SCM str = scm_c_make_bytevector (0); >> SCM port = scm_open_bytevector_input_port (str, SCM_UNDEFINED); >> scm_set_port_filename_x (port, scm_from_locale_string ("/usr/local/tmp/lilypond/ly/init.ly")); >> return 0; >> } >> >> >> crashes with the backtrace >> >> Program terminated with signal SIGSEGV, Segmentation fault. >> #0 0xb7699059 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 >> (gdb) bt >> #0 0xb7699059 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 >> #1 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 >> #2 0xb7699153 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 >> #3 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 >> #4 0xb7699153 in scm_iprlist () from /usr/lib/libguile-2.0.so.22 >> #5 0xb7699e95 in ?? () from /usr/lib/libguile-2.0.so.22 >> #6 0xb7698ec9 in scm_prin1 () from /usr/lib/libguile-2.0.so.22 >> #7 0xb769a606 in scm_simple_format () from /usr/lib/libguile-2.0.so.22 >> #8 0xb76e5f0b in ?? () from /usr/lib/libguile-2.0.so.22 >> #9 0xb76e6539 in ?? () from /usr/lib/libguile-2.0.so.22 >> #10 0xb76e664c in scm_call_with_vm () from /usr/lib/libguile-2.0.so.22 >> #11 0xb764cc67 in scm_apply () from /usr/lib/libguile-2.0.so.22 >> #12 0xb764e90e in scm_apply_1 () from /usr/lib/libguile-2.0.so.22 >> #13 0xb76cdb7b in scm_throw () from /usr/lib/libguile-2.0.so.22 >> #14 0xb76ce04c in scm_ithrow () from /usr/lib/libguile-2.0.so.22 >> #15 0xb764b6a3 in scm_error_scm () from /usr/lib/libguile-2.0.so.22 >> #16 0xb764b778 in scm_error () from /usr/lib/libguile-2.0.so.22 >> #17 0xb764ba22 in scm_wrong_type_arg () from /usr/lib/libguile-2.0.so.22 >> #18 0xb76927ca in scm_set_port_filename_x () from /usr/lib/libguile-2.0.so.22 >> #19 0x08048723 in main () at nextbug.c:8 >> >> after outputting >> >> guile: uncaught throw to wrong-type-arg: (set-port-filename! Wrong >> type argument in position ~A: ~S (1 (Segmentation fault (core dumped) > > The problem turns out to be that binary ports are not initialized until > the (ice-9 binary-ports) module is loaded. As a result, the port > returned by 'scm_open_bytevector_input_port' has a bad type tag. > > The workaround is to call scm_c_resolve_module ("ice-9 binary-ports") > after initializing Guile before the first call to > 'scm_open_bytevector_input_port'. The following code works: > > #include > > int main() > { > scm_init_guile (); > (void) scm_c_resolve_module ("ice-9 binary-ports"); > SCM str = scm_c_make_bytevector (0); > SCM port = scm_open_bytevector_input_port (str, SCM_UNDEFINED); > scm_set_port_filename_x (port, scm_from_locale_string ("/usr/local/tmp/lilypond/ly/init.ly")); > return 0; > } > > Mark From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 28 14:47:48 2015 Received: (at 20209) by debbugs.gnu.org; 28 Mar 2015 18:47:48 +0000 Received: from localhost ([127.0.0.1]:39079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ybvlr-0007iv-KI for submit@debbugs.gnu.org; Sat, 28 Mar 2015 14:47:47 -0400 Received: from world.peace.net ([50.252.239.5]:47467 ident=hope5) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ybvlo-0007im-Sd for 20209@debbugs.gnu.org; Sat, 28 Mar 2015 14:47:45 -0400 Received: from [10.1.10.78] (helo=jojen) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Ybvlj-0007Vs-12; Sat, 28 Mar 2015 14:47:39 -0400 From: Mark H Weaver To: David Kastrup Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87bnje26qf.fsf@fencepost.gnu.org> Date: Sat, 28 Mar 2015 14:48:10 -0400 In-Reply-To: <87bnje26qf.fsf@fencepost.gnu.org> (David Kastrup's message of "Fri, 27 Mar 2015 09:18:48 +0100") Message-ID: <87pp7tarh1.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20209 Cc: 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) David Kastrup writes: > It's also a rather inscrutable error symptom. Any chance wrong-type-arg > can guard against uninitialized/invalid types specifically? In this case the "bad type tag" was a valid tag, but not the one intended for ports. The tags of the returned port indicated that it was a pair those car contained a non-immediate object located at an unmapped address, which caused a segfault while trying to print it. Mark From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 29 09:06:52 2015 Received: (at 20209) by debbugs.gnu.org; 29 Mar 2015 13:06:52 +0000 Received: from localhost ([127.0.0.1]:39385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YcCvU-0004wN-1U for submit@debbugs.gnu.org; Sun, 29 Mar 2015 09:06:52 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:53426 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YcCvS-0004wG-Hm for 20209@debbugs.gnu.org; Sun, 29 Mar 2015 09:06:50 -0400 Received: from reverse-83.fdn.fr ([80.67.176.83]:49577 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1YcCvR-0003dp-B0; Sun, 29 Mar 2015 09:06:49 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mark H Weaver Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87y4mhasqb.fsf@netris.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 Germinal an 223 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Sun, 29 Mar 2015 15:06:47 +0200 In-Reply-To: <87y4mhasqb.fsf@netris.org> (Mark H. Weaver's message of "Sat, 28 Mar 2015 14:21:00 -0400") Message-ID: <87twx40x7c.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 20209 Cc: David Kastrup , 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Mark H Weaver skribis: > For these reasons, I decided against recommending those undocumented > initialization functions. Instead, I suggested that David initialize > binary ports by loading (ice-9 binary-ports): > > (void) scm_c_resolve_module ("ice-9 binary-ports"); That sounds like the best option, indeed. > For Guile 2.0.12, I suggest that we unconditionally do the equivalent of > 'scm_init_bytevectors' and 'scm_init_r6rs_ports' during Guile > initialization, and make those functions into deprecated no-ops. Agreed, that=E2=80=99s what I was going to suggest. That these init functions are not marked as internal is really an oversight. I wouldn=E2=80=99t be against simply making them SCM_INTERNAL in 2.0.12, but making them public + deprecated as you suggest is even better. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 23 12:34:21 2016 Received: (at 20209) by debbugs.gnu.org; 23 Jun 2016 16:34:21 +0000 Received: from localhost ([127.0.0.1]:52878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG7a9-0006fB-D1 for submit@debbugs.gnu.org; Thu, 23 Jun 2016 12:34:21 -0400 Received: from pb-sasl1.pobox.com ([64.147.108.66]:53832 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG7a7-0006f2-0O for 20209@debbugs.gnu.org; Thu, 23 Jun 2016 12:34:19 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 674CA244AF; Thu, 23 Jun 2016 12:34:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=51Jz35LuNc9fPgKJ/u2/Bw8vaaY=; b=MopupJ zrhTvKGAxBQjSnmEehTgDOCcp+JY58r04zHPxCmHGe7GiwYp2t7ACKbmumTQ568h 3z9e+C0GsolR6X7coq3mLVFbL5xE4Lkn5OXtBlT1PIPA5/jWPeQNAnxVWqqRdeFl HJZBs+AmI1dM2Z4ivgiG0R1hL4XSqEKFBm6os= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=nK6C5e66P4uXxaYR8lVGiUdFxWzTg45b SYjOhHElxfTAs0CKxsARQ3Vi0yfIjKZt917oZKSsWO54hMfnhyde/Cyiie6L+qFW BTi0hrIcWdWw/MAk6xvITdig+pdk82A2NmLzgUrg7XOn4vLnTiO42gsEoz/q6dIc YkGOmmJ9/9g= Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 50150244AE; Thu, 23 Jun 2016 12:34:17 -0400 (EDT) Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 4AFC3244AD; Thu, 23 Jun 2016 12:34:16 -0400 (EDT) From: Andy Wingo To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87y4mhasqb.fsf@netris.org> <87twx40x7c.fsf@gnu.org> Date: Thu, 23 Jun 2016 18:34:09 +0200 In-Reply-To: <87twx40x7c.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 29 Mar 2015 15:06:47 +0200") Message-ID: <87r3bnn9tq.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Pobox-Relay-ID: 53B8FFA4-3960-11E6-8AE2-C1836462E9F6-02397024!pb-sasl1.pobox.com X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 20209 Cc: Mark H Weaver , David Kastrup , 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun 29 Mar 2015 15:06, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Mark H Weaver skribis: > >> For these reasons, I decided against recommending those undocumented >> initialization functions. Instead, I suggested that David initialize >> binary ports by loading (ice-9 binary-ports): >> >> (void) scm_c_resolve_module ("ice-9 binary-ports"); > > That sounds like the best option, indeed. > >> For Guile 2.0.12, I suggest that we unconditionally do the equivalent of >> 'scm_init_bytevectors' and 'scm_init_r6rs_ports' during Guile >> initialization, and make those functions into deprecated no-ops. > > Agreed, that=E2=80=99s what I was going to suggest. > > That these init functions are not marked as internal is really an > oversight. > > I wouldn=E2=80=99t be against simply making them SCM_INTERNAL in 2.0.12, = but > making them public + deprecated as you suggest is even better. WDYT about something like this? --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Register-R6RS-port-and-bytevector-internals-early.patch >From f763f353e438de985577ef4b88b805bd4d4c9b77 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 23 Jun 2016 18:31:55 +0200 Subject: [PATCH] Register R6RS port and bytevector internals early * libguile/bytevectors.c (sym_big, sym_little): Rename from scm_sym_big and scm_sym_little, and don't use the snarf mechanism as we need to initialize this value eagerly in case the C API is used before the Scheme module is loaded. (scm_bootstrap_bytevectors): Initialize the endianness symbols here. * libguile/r6rs-ports.c (scm_register_r6rs_ports): Register the R6RS port kinds here, for the same reason. --- libguile/bytevectors.c | 24 ++++++++++++------------ libguile/r6rs-ports.c | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c index cb7f294..86d1bdf 100644 --- a/libguile/bytevectors.c +++ b/libguile/bytevectors.c @@ -418,8 +418,8 @@ scm_i_print_bytevector (SCM bv, SCM port, scm_print_state *pstate SCM_UNUSED) /* General operations. */ -SCM_SYMBOL (scm_sym_big, "big"); -SCM_SYMBOL (scm_sym_little, "little"); +static SCM sym_big; +static SCM sym_little; SCM scm_endianness_big, scm_endianness_little; @@ -799,13 +799,13 @@ bytevector_large_ref (const char *c_bv, size_t c_size, int signed_p, if (signed_p) { - if (scm_is_eq (endianness, scm_sym_big)) + if (scm_is_eq (endianness, sym_big)) negative_p = c_bv[0] & 0x80; else negative_p = c_bv[c_size - 1] & 0x80; } - c_endianness = scm_is_eq (endianness, scm_sym_big) ? 1 : -1; + c_endianness = scm_is_eq (endianness, sym_big) ? 1 : -1; mpz_init (c_mpz); mpz_import (c_mpz, 1 /* 1 word */, 1 /* word order doesn't matter */, @@ -832,7 +832,7 @@ bytevector_large_set (char *c_bv, size_t c_size, int signed_p, mpz_t c_mpz; int c_endianness, c_sign, err = 0; - c_endianness = scm_is_eq (endianness, scm_sym_big) ? 1 : -1; + c_endianness = scm_is_eq (endianness, sym_big) ? 1 : -1; mpz_init (c_mpz); scm_to_mpz (value, c_mpz); @@ -1864,9 +1864,9 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness) ? "32" : "??")))); strcat (name, - ((scm_is_eq (endianness, scm_sym_big)) + ((scm_is_eq (endianness, sym_big)) ? "BE" - : ((scm_is_eq (endianness, scm_sym_little)) + : ((scm_is_eq (endianness, sym_little)) ? "LE" : "unknown"))); } @@ -1884,7 +1884,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness) \ SCM_VALIDATE_STRING (1, str); \ if (scm_is_eq (endianness, SCM_UNDEFINED)) \ - endianness = scm_sym_big; \ + endianness = sym_big; \ else \ SCM_VALIDATE_SYMBOL (2, endianness); \ \ @@ -2001,7 +2001,7 @@ SCM_DEFINE (scm_string_to_utf32, "string->utf32", \ SCM_VALIDATE_BYTEVECTOR (1, utf); \ if (scm_is_eq (endianness, SCM_UNDEFINED)) \ - endianness = scm_sym_big; \ + endianness = sym_big; \ else \ SCM_VALIDATE_SYMBOL (2, endianness); \ \ @@ -2266,13 +2266,13 @@ scm_bootstrap_bytevectors (void) (scm_i_array_element_types[SCM_ARRAY_ELEMENT_TYPE_VU8], scm_make_bytevector); } + + scm_endianness_big = sym_big = scm_from_latin1_symbol ("big"); + scm_endianness_little = sym_little = scm_from_latin1_symbol ("little"); } void scm_init_bytevectors (void) { #include "libguile/bytevectors.x" - - scm_endianness_big = scm_sym_big; - scm_endianness_little = scm_sym_little; } diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c index bd8a1c4..5d283d2 100644 --- a/libguile/r6rs-ports.c +++ b/libguile/r6rs-ports.c @@ -1400,12 +1400,6 @@ scm_register_r6rs_ports (void) "scm_init_r6rs_ports", (scm_t_extension_init_func) scm_init_r6rs_ports, NULL); -} - -void -scm_init_r6rs_ports (void) -{ -#include "libguile/r6rs-ports.x" initialize_bytevector_input_ports (); initialize_custom_binary_input_ports (); @@ -1413,3 +1407,9 @@ scm_init_r6rs_ports (void) initialize_custom_binary_output_ports (); initialize_transcoded_ports (); } + +void +scm_init_r6rs_ports (void) +{ +#include "libguile/r6rs-ports.x" +} -- 2.8.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 23 12:59:14 2016 Received: (at 20209) by debbugs.gnu.org; 23 Jun 2016 16:59:14 +0000 Received: from localhost ([127.0.0.1]:52912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG7yE-0000Se-Cf for submit@debbugs.gnu.org; Thu, 23 Jun 2016 12:59:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG7yC-0000SO-A2 for 20209@debbugs.gnu.org; Thu, 23 Jun 2016 12:59:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG7y6-00089F-AI for 20209@debbugs.gnu.org; Thu, 23 Jun 2016 12:59:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39572 helo=lola.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG7y6-000895-1e; Thu, 23 Jun 2016 12:59:06 -0400 Received: by lola.localdomain (Postfix, from userid 1000) id 2E497DF785; Thu, 23 Jun 2016 18:59:04 +0200 (CEST) From: David Kastrup To: Andy Wingo Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87y4mhasqb.fsf@netris.org> <87twx40x7c.fsf@gnu.org> <87r3bnn9tq.fsf@pobox.com> Date: Thu, 23 Jun 2016 18:59:04 +0200 In-Reply-To: <87r3bnn9tq.fsf@pobox.com> (Andy Wingo's message of "Thu, 23 Jun 2016 18:34:09 +0200") Message-ID: <87shw3et9j.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (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.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 20209 Cc: Mark H Weaver , Ludovic =?iso-8859-1?Q?Court=E8s?= , 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) Andy Wingo writes: > On Sun 29 Mar 2015 15:06, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Mark H Weaver skribis: >> >>> For these reasons, I decided against recommending those undocumented >>> initialization functions. Instead, I suggested that David initialize >>> binary ports by loading (ice-9 binary-ports): >>> >>> (void) scm_c_resolve_module ("ice-9 binary-ports"); >> >> That sounds like the best option, indeed. >> >>> For Guile 2.0.12, I suggest that we unconditionally do the equivalent of >>> 'scm_init_bytevectors' and 'scm_init_r6rs_ports' during Guile >>> initialization, and make those functions into deprecated no-ops. >> >> Agreed, that=E2=80=99s what I was going to suggest. >> >> That these init functions are not marked as internal is really an >> oversight. >> >> I wouldn=E2=80=99t be against simply making them SCM_INTERNAL in 2.0.12,= but >> making them public + deprecated as you suggest is even better. > > WDYT about something like this? I don't see anything protecting sym_big or sym_little (more accurately, 'big or 'little which are non-immediate SCM values) from collection which would make sym_big and sym_little useless for comparison. I'm assuming that not the whole bss segment is getting scanned by BoehmGC. --=20 David Kastrup From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 23 14:01:26 2016 Received: (at 20209) by debbugs.gnu.org; 23 Jun 2016 18:01:26 +0000 Received: from localhost ([127.0.0.1]:52958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG8wQ-00024g-4W for submit@debbugs.gnu.org; Thu, 23 Jun 2016 14:01:26 -0400 Received: from pb-sasl2.pobox.com ([64.147.108.67]:57695 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG8wN-00024X-Jn for 20209@debbugs.gnu.org; Thu, 23 Jun 2016 14:01:25 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 4DBB925471; Thu, 23 Jun 2016 14:01:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=pNwI6kcOS8NF5tj1iKa69aahIGo=; b=nI6nUo HeeZhnjMliDj+e8cQEbYEk8fRDTyJF/TpsVcTSdpD1873MMnPAzu2PspJRXVUrXL wOYpxhtQZAm7yCsLum0PH13TtmWAO1PuoSg27CtSEW8+2apGbQhuZVoTP+U3yIED GSJzmU4CW2Llb0iVLlq+BeNI6bm/DKAle63PU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=e4XzOh1HPsqgRnCUBpcHinO8IJ22hjU7 nEPRFuTtYI5XiCPzrQ8nz59sJelcWl825wXZRplbf2hir7m2ZqSKyC2ZxE1aza8m llyjxWdx4Z8WPuOQCUheWXgAQv9GxsXtE5c2/JuFAcqpDX6Jpp6f8RGyb1tWLmd9 G1uQFFA7pZ4= Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 41EA42546F; Thu, 23 Jun 2016 14:01:23 -0400 (EDT) Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 607AF2546A; Thu, 23 Jun 2016 14:01:22 -0400 (EDT) From: Andy Wingo To: David Kastrup Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87y4mhasqb.fsf@netris.org> <87twx40x7c.fsf@gnu.org> <87r3bnn9tq.fsf@pobox.com> <87shw3et9j.fsf@fencepost.gnu.org> Date: Thu, 23 Jun 2016 20:01:15 +0200 In-Reply-To: <87shw3et9j.fsf@fencepost.gnu.org> (David Kastrup's message of "Thu, 23 Jun 2016 18:59:04 +0200") Message-ID: <87eg7nn5sk.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 7EBA9CA6-396C-11E6-92D3-28A6F1301B6D-02397024!pb-sasl2.pobox.com X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 20209 Cc: Mark H Weaver , Ludovic =?utf-8?Q?Court=C3=A8s?= , 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Thu 23 Jun 2016 18:59, David Kastrup writes: > I don't see anything protecting sym_big or sym_little (more accurately, > 'big or 'little which are non-immediate SCM values) from collection > which would make sym_big and sym_little useless for comparison. > > I'm assuming that not the whole bss segment is getting scanned by > BoehmGC. The whole bss segment is scanned by the GC :) See the third paragraph here. https://www.gnu.org/software/guile/docs/master/guile.html/Garbage-Collection.html#Garbage-Collection This section applies to 2.0 as well. Andy From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 23 14:46:02 2016 Received: (at 20209) by debbugs.gnu.org; 23 Jun 2016 18:46:02 +0000 Received: from localhost ([127.0.0.1]:52979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG9da-0003FE-Gk for submit@debbugs.gnu.org; Thu, 23 Jun 2016 14:46:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG9dY-0003Eh-JY for 20209@debbugs.gnu.org; Thu, 23 Jun 2016 14:46:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG9dR-0003ew-PY for 20209@debbugs.gnu.org; Thu, 23 Jun 2016 14:45:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41544 helo=lola.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG9dR-0003ek-Gk; Thu, 23 Jun 2016 14:45:53 -0400 Received: by lola.localdomain (Postfix, from userid 1000) id C3921DF783; Thu, 23 Jun 2016 20:45:51 +0200 (CEST) From: David Kastrup To: Andy Wingo Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87y4mhasqb.fsf@netris.org> <87twx40x7c.fsf@gnu.org> <87r3bnn9tq.fsf@pobox.com> <87shw3et9j.fsf@fencepost.gnu.org> <87eg7nn5sk.fsf@pobox.com> Date: Thu, 23 Jun 2016 20:45:51 +0200 In-Reply-To: <87eg7nn5sk.fsf@pobox.com> (Andy Wingo's message of "Thu, 23 Jun 2016 20:01:15 +0200") Message-ID: <87oa6reobk.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (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.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 20209 Cc: Mark H Weaver , Ludovic =?iso-8859-1?Q?Court=E8s?= , 20209@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) Andy Wingo writes: > On Thu 23 Jun 2016 18:59, David Kastrup writes: > >> I don't see anything protecting sym_big or sym_little (more accurately, >> 'big or 'little which are non-immediate SCM values) from collection >> which would make sym_big and sym_little useless for comparison. >> >> I'm assuming that not the whole bss segment is getting scanned by >> BoehmGC. > > The whole bss segment is scanned by the GC :) See the third paragraph > here. > > https://www.gnu.org/software/guile/docs/master/guile.html/Garbage-Colle= ction.html#Garbage-Collection > > This section applies to 2.0 as well. Sigh. In practice, the wasted memory seems to be no problem, as the static C root set is almost always finite and small, given that the Scheme stack is separate from the C stack." "almost always" means "for trivial applications and/or applications only written in Scheme". But Guile is marketed as an _extension_ language. LilyPond has a table-driven lexer and parser and quite a bit of other static data. A quick peek with ld shows .bss 0x0000000000aa2340 0x21218 .data 0x0000000000aa1080 0x12a0 Ok, .data seems absurdly compact for a table-driven parser with something like 800 states alone, let alone all the rest. So I might have problems interpreting the output. At any rate, .bss does not look exactly small. Obviously, I am not overly happy with the design choices and rationale taken for Guile-2.x memory management. These =E2=80=9Cfalse positives=E2=80=9D might keep SCM objects alive th= at would otherwise be considered dead. While this might waste memory, keeping an object around longer than it strictly needs to is harmless. Except that a single object may keep a whole lot of other stuff alive. LilyPond is usually called once for compiling literally thousands of files in one session sequentially. It makes sure to call garbage collection explicitly between files, when the return stack is indeed guaranteed to be quite small. Using Guile-1.8 we actually track non-freed objects at that time in our testing versions (by setting a flag that will let the mark hooks complain for object types that should not be around at that time). It does deliver false positives but at a pretty moderate rate: I'd guess about 5% or so of complete runs through the regression test database are affected. We won't be able to do these tests with Guile-2 anyway since they format output in the marking phase and that crashes the GC subsystem (it's likely not kosher in Guile-1 either but the GC character is more sequential there). I doubt that the false positive rate would stay that low when conservatively marking all the data segments rather than just the stack at a known low mark. And I don't really see how to optimize for application layout patterns _not_ matching Guile's assumptions which again takes us to the question how much an extension language should determine the design of the main application. Obviously, I have no problem with Guile deciding to conservatively scan the libguile data segments: the layout and size of those are under its own control. Either way, sym_big and sym_little seem to be covered. --=20 David Kastrup From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 08:20:26 2017 Received: (at 20209-done) by debbugs.gnu.org; 28 Feb 2017 13:20:26 +0000 Received: from localhost ([127.0.0.1]:59183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cihhZ-0006au-St for submit@debbugs.gnu.org; Tue, 28 Feb 2017 08:20:26 -0500 Received: from pb-sasl2.pobox.com ([64.147.108.67]:53289 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cihhX-0006ak-UF for 20209-done@debbugs.gnu.org; Tue, 28 Feb 2017 08:20:24 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 798D95E000; Tue, 28 Feb 2017 08:20:22 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=C09z/r+xO8ner8ZnHl0ZQeWrQqc=; b=xJE+vg 8ggrZKCRjV19liJ42Taoma4ZUeRt5K2Kpdgkqs04aAXWdOqE9cNNaSnoojNKaXjt coACGHIphtz4D8bF+dIeBwR1oKObFF4akin49xJ/IpWYSYJvPtkgr2p3csVhzXM/ R5Tze+bzkEjkTFqXlrP83vayf4arNWgIAhM1Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=eCQSeBGI8g7DcbHX08wnC9bJ+FCCFCxh lKiQc02pyhQ3M9gApnHHWDn5vuRxQizbmQuIFXef4hZY0ihfnHTZCWGjqHlmhjO3 b0NlH781JOoZoj3X3ftaaKzQFPtCnOup4N5Luv0cxRnQ3V5pew5zXCe9ATrki4nU 9GuhRo2G9YI= Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 719EF5DFFF; Tue, 28 Feb 2017 08:20:22 -0500 (EST) Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 7A2145DFFE; Tue, 28 Feb 2017 08:20:21 -0500 (EST) From: Andy Wingo To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports References: <87fv8r1pio.fsf@fencepost.gnu.org> <87egob8irs.fsf@netris.org> <87y4mhasqb.fsf@netris.org> <87twx40x7c.fsf@gnu.org> <87r3bnn9tq.fsf@pobox.com> Date: Tue, 28 Feb 2017 14:20:14 +0100 In-Reply-To: <87r3bnn9tq.fsf@pobox.com> (Andy Wingo's message of "Thu, 23 Jun 2016 18:34:09 +0200") Message-ID: <87innuo3jl.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: A820B6B4-FDB8-11E6-BF99-6141F2301B6D-02397024!pb-sasl2.pobox.com X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20209-done Cc: Mark H Weaver , 20209-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On Thu 23 Jun 2016 18:34, Andy Wingo writes: > From: Andy Wingo > Date: Thu, 23 Jun 2016 18:31:55 +0200 > Subject: [PATCH] Register R6RS port and bytevector internals early > > * libguile/bytevectors.c (sym_big, sym_little): Rename from scm_sym_big > and scm_sym_little, and don't use the snarf mechanism as we need to > initialize this value eagerly in case the C API is used before the > Scheme module is loaded. > (scm_bootstrap_bytevectors): Initialize the endianness symbols here. > * libguile/r6rs-ports.c (scm_register_r6rs_ports): Register the R6RS > port kinds here, for the same reason. Already applied to 2.0; now applied to master too. Andy From unknown Mon Jun 23 05:59:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 29 Mar 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator