From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.bugs Subject: bug#20109: Incompatible API change in 2.0 series for string port encoding Date: Sun, 15 Mar 2015 14:15:56 +0100 Message-ID: <87mw3eh04z.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426425442 11001 80.91.229.3 (15 Mar 2015 13:17:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Mar 2015 13:17:22 +0000 (UTC) To: 20109@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Mar 15 14:17:11 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YX8Pk-0003kP-PQ for guile-bugs@m.gmane.org; Sun, 15 Mar 2015 14:17:08 +0100 Original-Received: from localhost ([::1]:43495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8Pj-00034Y-Je for guile-bugs@m.gmane.org; Sun, 15 Mar 2015 09:17:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8Pf-00034I-Lk for bug-guile@gnu.org; Sun, 15 Mar 2015 09:17:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YX8Pe-00018U-Hx for bug-guile@gnu.org; Sun, 15 Mar 2015 09:17:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8Pe-00018N-ED for bug-guile@gnu.org; Sun, 15 Mar 2015 09:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YX8Pe-00078N-1R for bug-guile@gnu.org; Sun, 15 Mar 2015 09:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Kastrup Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 15 Mar 2015 13:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20109 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142642537327362 (code B ref -1); Sun, 15 Mar 2015 13:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Mar 2015 13:16:13 +0000 Original-Received: from localhost ([127.0.0.1]:47025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YX8Or-00077G-1j for submit@debbugs.gnu.org; Sun, 15 Mar 2015 09:16:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60290) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YX8Oo-000778-UD for submit@debbugs.gnu.org; Sun, 15 Mar 2015 09:16:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YX8On-0000d8-O2 for submit@debbugs.gnu.org; Sun, 15 Mar 2015 09:16:10 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8On-0000d3-Kw for submit@debbugs.gnu.org; Sun, 15 Mar 2015 09:16:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8Om-000330-PE for bug-guile@gnu.org; Sun, 15 Mar 2015 09:16:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YX8Ol-0000cj-Q0 for bug-guile@gnu.org; Sun, 15 Mar 2015 09:16:08 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8Ol-0000cf-MO for bug-guile@gnu.org; Sun, 15 Mar 2015 09:16:07 -0400 Original-Received: from localhost ([127.0.0.1]:57844 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YX8Ol-0004Fp-BY for bug-guile@gnu.org; Sun, 15 Mar 2015 09:16:07 -0400 Original-Received: by lola (Postfix, from userid 1000) id 98F82E051E; Sun, 15 Mar 2015 14:15:56 +0100 (CET) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7749 Archived-At: In 2.0.9, the following patch/code for getting what amounts to a binary string port worked. commit 7f7a124d3470b0d566f796e88f4e2ad5aa043f16 Author: David Kastrup Date: Sun Sep 21 18:40:06 2014 +0200 Source_file::init_port: Keep GUILEv2 from redecoding string input diff --git a/lily/source-file.cc b/lily/source-file.cc index 1118b9d..75ed0d9 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -152,7 +152,11 @@ Source_file::init_port () // we do our own utf8 encoding and verification in the parser, so we // use the no-conversion equivalent of latin1 SCM str = scm_from_latin1_string (c_str ()); - str_port_ = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG, __FUNCTION__); + scm_dynwind_begin ((scm_t_dynwind_flags)0); + // Why doesn't scm_set_port_encoding_x work here? + scm_dynwind_fluid (ly_lily_module_constant ("%default-port-encoding"), SCM_BOOL_F); + str_port_ = scm_open_input_string (str); + scm_dynwind_end (); scm_set_port_filename_x (str_port_, ly_string2scm (name_)); } In 2.0.11, it doesn't. This is an incompatible API change within the "stable" 2.0 series. Since we are ping-ponging between GUILE and a native LilyPond interpreter and need to work with file offsets for keeping them in synch, it isn't an option to have scm_open_input_string convert to a different encoding. It also does not make sense from an efficiency point of view since strings are either encoded as latin-1 or UTF-32, so encoding string ports as UTF-8 without alternative means that it is _impossible_ to employ string ports efficiently and without conversion. -- David Kastrup