From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.lisp.guile.bugs Subject: Re: =?windows-1252?Q?=91scm=5Ffrom=5Flocale=5Fstring=92_and_?= =?windows-1252?Q?locale_character_encoding?= Date: Mon, 18 Jul 2011 09:18:13 -0700 Message-ID: <4E245CC5.4040505__24262.3642822311$1311010296$gmane$org@gnu.org> References: <20110710.001131.2114114687665811411.pipping@lavabit.com> <4E1AFA72.2050803@gnu.org> <871uxud0s7.fsf@pobox.com> <4E1D95A0.60504@gnu.org> <87oc0yb8mh.fsf@pobox.com> <4E1DB59B.9070700@gnu.org> <87vcv5kzhk.fsf@pobox.com> <877h7gljlv.fsf_-_@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1311010296 4715 80.91.229.12 (18 Jul 2011 17:31:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2011 17:31:36 +0000 (UTC) Cc: bug-guile@gnu.org, bug-autogen@gnu.org, Elias Pipping To: =?windows-1252?Q?Ludovic_Court=E8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jul 18 19:31:28 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QirfC-0007ET-Av for guile-bugs@m.gmane.org; Mon, 18 Jul 2011 19:31:26 +0200 Original-Received: from localhost ([::1]:38296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QirfB-0007pV-Bz for guile-bugs@m.gmane.org; Mon, 18 Jul 2011 13:31:25 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QiqWS-000450-DL for bug-guile@gnu.org; Mon, 18 Jul 2011 12:18:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QiqWQ-0006TP-Ne for bug-guile@gnu.org; Mon, 18 Jul 2011 12:18:20 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:51911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QiqWQ-0006TJ-DA; Mon, 18 Jul 2011 12:18:18 -0400 Original-Received: from adsl-75-0-180-226.dsl.pltn13.sbcglobal.net ([75.0.180.226]:57387 helo=[10.0.0.2]) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QiqWN-0001nu-KC; Mon, 18 Jul 2011 12:18:15 -0400 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11 In-Reply-To: <877h7gljlv.fsf_-_@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list 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:5738 Archived-At: On 07/17/11 13:47, Ludovic Courtès wrote: > FWIW, I do understand the inconvenience and frustration reported here. > > But as Andy suggests, I think it should come as no surprise that > ‘scm_from_locale_string’ returns a string from a locale-encoded one. > Guile 1.8 already documented things this way [0]. The issue is less about scm_from_locale_string than: * This appears to me to be habitual. If it were not, my glue layer would not be so large. * This is a behavioral change in a bug fix release. The kind of change one might more readily anticipate in a 2.0.x to 2.1 transition. * There was no warning mechanism put in place. Release docs don't count because code I ship now will be built against Guile releases that have not been released yet. I've not seen 2.0.2 even yet. WRT the misuse of this particular function, what happened from my perspective is that I was happily using the SCM_CHARS stuff with: export GUILE_WARN_DEPRECATED=detailed in my testing environment and not getting any testing errors. Then my clients report that they cannot build it any more. (Why didn't the deprecation warning fire? How about adding GUILE_ERROR_DEPRECATED?? Then my testing should fail immediately! In any event, I scan the test logs for "warn" and saw nothing.) Somebody somewhere said, "use scm_from_locale_string". I looked it up and saw no better alternative, used it and it worked as I needed it to. Now it doesn't. My biggest desire is to not have to read release documents and figure out if somewhere in there is something that affects my usage of the guile library interface. I want to be thumped with GUILE_WARN_DEPRECATED and have an obvious replacement. Thank you. /** * Get the NUL terminated string from an SCM. * As of Guile 1.7.x, access to the NUL terminated string referenced by * an SCM is no longer guaranteed. Therefore, we must extract the string * into one of our "scribble" buffers. * * @param s the string to convert * @param type a string describing the string * @return a NUL terminated string, or it aborts. */ LOCAL char * ag_scm2zchars(SCM s, const char * type) { #if GUILE_VERSION < 107000 /* pre-Guile 1.7.x */ if (! AG_SCM_STRING_P(s)) AG_ABEND(aprf(zNotStr, type)); if (SCM_SUBSTRP(s)) s = scm_makfromstr(SCM_CHARS(s), SCM_LENGTH(s), 0); return SCM_CHARS(s); #else static char const bad_val[] = "scm_string_length returned wrong value: %d != %d\n"; size_t len; char * buf; if (! AG_SCM_STRING_P(s)) AG_ABEND(aprf("%s is not a string", type)); len = scm_c_string_length(s); if (len == 0) { static char z = NUL; return &z; } buf = ag_scribble(len+1); { size_t buflen = scm_to_locale_stringbuf(s, buf, len); if (buflen != len) AG_ABEND(aprf(bad_val, buflen, len)); } buf[len] = NUL; return buf; #endif }